2025-04-22
UE5:DataTableのRowNameをドロップダウン選択する関数
この関数はC++で実装しています。
ドロップダウンで選択したRowNameを出力する関数です。
UFUNCTION
にmeta = (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;
}
コメントを送る
コメントはブログオーナーのみ閲覧できます