Site cover image
ゲーム開発に関すること

UE5:DataTableのRowNameをドロップダウン選択する関数

この関数はC++で実装しています。
ドロップダウンで選択したRowNameを出力する関数です。

UFUNCTIONmeta = (DataTablePin = "RefTable")を追加するだけでデータテーブルのRowNameのドロップダウン選択が可能になります。


MyBlueprintFunctionLibrary.h

UCLASS()
class UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	/* 指定したDataTableから選択したRowNameを返す */
	UFUNCTION(BlueprintCallable, BlueprintPure, meta = (DataTablePin = "RefTable"))
	static FName GetRowName(const UDataTable* RefTable, FName RowName);
};

meta = (DataTablePin = "RefTable")ではデータテーブルの引数を指定します。

MyBlueprintFunctionLibrary.cpp

FName UMyBlueprintFunctionLibrary::GetRowName(const UDataTable* RefTable, FName RowName)
{
    return RowName;
}

Thank you!
Thank you!
URLをコピーしました

コメントを送る

コメントはブログオーナーのみ閲覧できます