How to handle game exit?

Such a basic question, but I can’t find a solution - not on forums, not in engine. I see that Game mode have methods:


EndMatch();
AbortMatch();

But they’re not called! There’s also


SetMatchState();

That called several times (with different in values) when I click PIE. But when I click to stop a game in editor or simply close an editor it’s not called.
So how can I clean my data?

I’m not sure how to go about what you want, so hopefully someone will explain so I know too. But for EndMatch and AbortMatch, those are called to deal with the internal game state of the level. The FPS Shooter is a good example of this. Let’s say you have a game, and play to the best of 5 kills. Someone gets 5 kills, then everything restarts right? That’s usually when EndMatch would be called followed by something else.

EndMatch is called. Make sure that you are calling Super::StartMatch, etc. in your class so that the base class knows what state is in

It doesn’t called when I’m playing in editor.