Reputation: 11
I'm working in unreal and I'm trying to import a .csv asset as a data table at run time. This is my function below and it works for assets that are already imported into unreal but not for new assets.
Imported Data Path = DataTable'/Game/Blueprints/Data/ImportedData.ImportedData'
It doesn't work when I point it at the new file in the same folder it returns nothing
New Data Pathpath = DataTable'/Game/Blueprints/Data/NewData.csv'(or NewData.NewData)
I feel like I am missing a step, like defining the new files structure or the cast is failing because it isn't a UDataTable
yet. Any suggestions?
UDataTable * UUlyssesBPFunctions::LoadTableByPath(FName Path, bool& result)
{
result = false;
if (Path == NAME_None) return NULL;
UDataTable* LoadedTable = Cast<UDataTable>(StaticLoadObject(UDataTable::StaticClass(), NULL, *Path.ToString()));
return LoadedTable;
}
Upvotes: 0
Views: 4409
Reputation: 239
I believe this answer is a bit late for your question but it may benefit others as it benefitted me today.
Rama has a free blueprint function library of over 120+ custom blueprint nodes; one of which is "Save String file to Text". You just provide the Absolute path, the name of the file(including the file format. In this case, .csv) and the string to save and boom, it works.
I'll link down the plugin
Upvotes: 1