Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Developer Bastian © 2024
- // License Creative Commons DEED 4.0 (https://creativecommons.org/licenses/by-sa/4.0/deed.en)
- // Tutorial video at https://youtu.be/le4VYlJXASg
- // Part of an Unreal Basics video tutorial series at: https://bit.ly/Unreal_Basics_en
- bool ABA_DataLoader::LoadDataTable(FString Path)
- {
- // Loading a DataTable
- if (!Path.IsEmpty())
- {
- UDataTable* tDataTable;
- FSoftObjectPath DTPath = FSoftObjectPath(Path);
- tDataTable = Cast<UDataTable>(DTPath.ResolveObject());
- if (!tDataTable) {
- tDataTable = Cast<UDataTable>(DTPath.TryLoad());
- UE_LOG(LogTemp, Warning, TEXT("BA_DataLoader: Need to use slow LoadObject to load DataTable"));
- }
- if (tDataTable)
- {
- this->ConnectionsDT = tDataTable;
- UE_LOG(LogTemp, Log, TEXT("BA_DataLoader: Successfully loaded Connections DataTable '%s'"), *Path);
- return true;
- }
- else
- {
- UE_LOG(LogTemp, Error, TEXT("BA_DataLoader: Error loading Connections DataTable '%s'"), *Path);
- return false;
- }
- }
- UE_LOG(LogTemp, Error, TEXT("BA_DataLoader: No path specified to load DataTable"));
- return false;
- }
Add Comment
Please, Sign In to add comment