Hi everyone,
I am using my own datatables on the game and that works perfectly on PIE mode. Whenever I start standalone game, it cause crashes.
Error is:
Error LogWindows Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xfffff21c
Error LogWindows
Error LogWindows [Callstack] 0x00007ff9a48347d5 UE4Editor-CoreUObject.dll!UnknownFunction []
Error LogWindows [Callstack] 0x00007ff9d84b9578 UE4Editor-RTS2-0007.dll!UDataTable::FindRow<FPredefinedGameMode>() [e:\ue\ue_4.24\engine\source\runtime\engine\classes\engine\datatable.h:203]
Code beIow is the way I use to read DataTable,
void DataStore::ReadGameInfoData()
{
FSoftObjectPath UnitDataTablePath = FSoftObjectPath(TEXT("DataTable'/Game/Data/DefaultGameModes.DefaultGameModes'"));
DefaultGameModesData = Cast<UDataTable>(UnitDataTablePath.ResolveObject());
if (DefaultGameModesData == nullptr)
{
DefaultGameModesData = Cast<UDataTable>(UnitDataTablePath.TryLoad());
}
}
ReadGameInfoData function is called from GameInstance::Init function. And following DataStore::GetDefaultGameMode() function is called from GameMode::StartPlay function.
FRTSGameMode* DataStore::GetDefaultGameMode()
{
LOG_ERR("GetDefaultGameMode ");
if (DefaultGameModesData == nullptr)
{
LOG_ERR("DefaultGameModesData pointer is null");
ReadGameInfoData();
}
FPredefinedGameMode* GM = DefaultGameModesData->FindRow<FPredefinedGameMode>("GameInfos", TEXT(""));
if(GM != nullptr)
{
return GetRTSGameModeFromGameInfo(GM->ActiveGameModeIndex);
}
ensureMsgf(GM != nullptr, TEXT("GetDefaultGameMode GameModes is null"));
return nullptr;
}
Between “DefaultGameModesData pointer is null” log is never printed.
Thanks