PIE Crash on pressing stop - custom GameInstance

Hi there,

I’m having an issue wherein the editor crashes immediately after I press stop when playing in-editor.

This has only begun to happen after I have inherited GameInstance. Previously, I had a custom GameMode class that contained two objects which themselves held TMaps containing a custom ability class and one containing animations. I have moved these to the new GameInstance class.

The output does not yield any meaningful information, and the call stack simply suggests it crashes in the engine Tick function.

I think it is possible that it crashes because certain actors in my game are holding references to objects in these TMaps - at what point should I drop these references to ensure it does not crash when pressing stop?

Do you have any tick delegates? In general GameInstance::Shutdown() event is a good place to unregister and de-reference all of your custom stuff.

No delegates. I have overridden the Shutdown function but without luck - the editor crashes before even getting that far. Im trying to figure out where in the stack the crash occurs so i can intercept and remove the references by hand before it happens - just wondering if anyone knew which function and in which object might be best to do it? I am assuming there is some kind of EndPlay function, but it doesnt exist in the GameInstance…

Take a look at these docs perhaps: