1,想创建一个表结构继承 FTableRowBase

USTRUCT(BlueprintType)
struct Ftest:public FTableRowBase
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Item)
        int32 id;
};

2,然后创建表格文件(testbp),在编辑器,右键-其他-数据表格 选择你创建的类作为构造对象,

3,,加载这表格文件并使用,

ConstructorHelpers::FObjectFinder<UDataTable> _test_BP(TEXT("DataTable'/Game/testbp'"));

class UDataTable* _testTable = _test_BP.Object;

static const FString Context = FString(TEXT("Trying to read row"));

读取单行

Ftest* testRow= _testTable->FindRow<Ftest>(FName(一行的名字),Context);

读取多行

TArray<Ftest*>testRowsData;
 _testTable->GetAllRows<Ftest>(FString(TEXT("test")), testRowsData);

这样我们就可以根据条件循环去数组里查找数据了

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-12-20
  • 2021-12-18
  • 2022-12-23
  • 2021-04-28
猜你喜欢
  • 2021-10-02
  • 2021-05-03
  • 2021-10-01
  • 2021-11-24
  • 2021-12-11
相关资源
相似解决方案