Belven
(Belven)
June 2, 2019, 1:54pm
1
Hey, so I’m going to be working with UDataTable a lot and I understand how it all works now.
If it’s possible, how would I load a DataTable blueprint from C++ without using a ConstructorHelpers::FObjectFinder etc.?
ALSO, small thing, how do I access the row name of a struct that extends FTableRowBase e.g.
FMyDataStruct* someData = myDataTable->FindRow<FMyDataStruct>(...);
someData->rowName
1 Like
Just make EditAnywhere or EditDefaultsOnly UPROPERTY of UDataTable*
and then set it in property editor inside blueprint based of that class in “Class Defaults”
Since you placed FMyDataStruct in to template FindRow should automatically cast it to that structure
2 Likes
Belven
(Belven)
June 2, 2019, 10:37pm
3
Well I won’t have a blueprint of that class. I just need something that can load a blueprint without needing to be done within the constructor
1 Like
.h
FORCEINLINE UDataTable* LoadObjFromPath(const FName& Path)
{
if (Path == NAME_None) return NULL;
return Cast<UDataTable>(StaticLoadObject(UDataTable::StaticClass(), NULL, *Path.ToString()));
}
.cpp
LoadObjFromPath(TEXT(“PATHDIR”));
Puede buscar sobre eso
2 Likes
SaintRQ
(SaintRQ)
November 9, 2021, 3:07pm
5
FDTRH_Systems()
: DataTable(nullptr)
, RowName(NAME_None)
{
UDataTable* DT;
FSoftObjectPath UnitDataTablePath = FSoftObjectPath(TEXT("/Game/DATA/Blueprints/DataTables/DT_SystemData.DT_SystemData"));
DT = Cast<UDataTable>(UnitDataTablePath.ResolveObject());
if (DT)
{
DataTable = DT;
}
else DT = Cast<UDataTable>(UnitDataTablePath.TryLoad());
if (DT)
{
DataTable = DT;
}
}
3 Likes
Belven
(Belven)
November 9, 2021, 3:48pm
6
Wow, not worked on this project for a while but thanks
1 Like