zoukankan      html  css  js  c++  java
  • 使用ue4的数据表操作

    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);

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

  • 相关阅读:
    POJ 2065 高斯消元求解问题
    HDU1045-Fire Net
    HDU1863-畅通工程
    POJ2524-Ubiquitous Religions
    POJ1064-Cable master
    POJ2456-Aggressive cows
    HDU1272-小希迷宫
    POJ1611-The Suspects
    HDU4496-D-City
    HDU1232-畅通工程
  • 原文地址:https://www.cnblogs.com/liuanyin/p/10219694.html
Copyright © 2011-2022 走看看