Dedicated server won't quit

I have been trying to make dedicated server quit (stop running) when the number of players drops to zero. The blueprint prints “quiting game” that is my blueprint print node so I get to that code. However, Quit Game, Execute Console command (“quit”) nor Exectue console command (“exit”) do not end the server from running.

Is there any other way from killing the process apart from abort. I would like nice world cleanups so Destroyed are called on actors etc.

I think I have resolved the issue even though I do not like the solution very much. The Quit function (or equally console quit command) will only destroy the current viewport if the player controller exists (as it calls it for that controller). As the dedicated has no player controller, this calls are all silently ignored. The proper way to quit is to either set GIsRequestingExit to true, or to call FGenericPlatformMisc::RequestExit(false); The latter function also has the possibility to force exit (it calls abort, the output streams might just be terminated).

1 Like