- Home /
Handle editor playmode exit
Hello,
In my project I have a custom shutdown flow when exiting the game (shutdown some managers, unload some scenes and finally exit the application). The problem is that in the editor, all this is bypassed when exiting play mode via the top button.
Is there a way I could handle this?
I tried listening for EditorApplication.playModeStateChanged and forcing EditorApplication.isPlaying = true, and this almost works. Trouble is that for some reason, SceneManager.UnloadSceneAsync() no longer works after this.
Any help would be appreciated, Thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220613021346im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cannot close/unload a scene that is open in editor during playmode (using C# code)? 3 Answers
Get the currently open scene name or file name 8 Answers
Handling scene objects 1 Answer
'Resource file has already been unloaded' error when exiting application in Editor 1 Answer
Real time scene changes 1 Answer