2019년 1월 9일 수요일

UE4 - Load DataTable in Runtime

  1. UDataTable * UUlyssesBPFunctions::LoadTableByPath(FName Path, bool& result)
  2. {
  3. result = false;
  4. if (Path == NAME_None) return NULL;
  5. UDataTable* LoadedTable =
  6. Cast<UDataTable>(StaticLoadObject(UDataTable::StaticClass(), NULL, *Path.ToString()));
  7. return LoadedTable;
  8. }





UDataTable* LoadedTable =
Cast<UDataTable>(StaticLoadObject(UDataTable::StaticClass(), NULL, *Path.ToString()));


Example Path :

UDataTable* LoadedTable =
Cast<UDataTable>(StaticLoadObject(UDataTable::StaticClass(), NULL, TEXT("DataTable '/Game/Data/ItemDB.ItemDB'")));