I made a new game instance object and configured the Unreal project settings to use it by default. Everything compiles fine.
In the game mode, I added the following:
UBlahGameInstance* BGI = Cast<UBlahGameInstance>(GetGameInstance()); AND UBlahGameInstance* BGI = Cast<UBlahGameInstance>(GetWorld()->GetGameInstance());
The code compiles fine but when I run the Unreal editor, it always crashes with the following error:
Access violation - code c0000005 (first/second chance not available)
Can anyone please tell me the correct way to access the game instance or is the above method correct?