I’m implementing saving in my game and I’m finding conflicting info online on how to save on exit in Unreal. Which of these is the correct way?
A. Listen to the event dispatchers
ApplicationShouldUnloadResourcesDelegate (alt+F4 on PC will trigger only
ApplicationWillTerminateDelegate, it seems).
B. Implement a custom GameEngine class just for this, as is described here: https://answers.unrealengine.com/questions/127897/event-on-close.html
BeginDestroy on my GameMode class. (This crashes my game in the call to
UGameplayStatics::CreateSaveGameObject so I guess that if this is the way to do it, then I’m doing it wrong?)
D. Something else?
Which is the most reliable way to save on exit? (Note that PC is currently my only targeted platform, but I would prefer to know the best way in general that covers all platforms.)
Also, is doing async save using
UGameplayStatics::AsyncSaveGameToSlot on exit a bad idea, or is it actually good since Unreal can continue other shutdown logic and waits to make sure the save is finished before final termination?