Search Issue Tracker
Fixed in 2021.1.X
Fixed in 2019.4.X, 2020.3.X
Votes
12
Found in
2018.4
2019.4.2f1
2020.2
Issue ID
1261125
Regression
No
OnApplicationQuit method is called before Application.wantsToQuit event is raised
How to reproduce:
1. Open user's attached "quit_test 2019.4.zip" project
2. Open "SampleScene" Scene
3. Enter Play Mode
4. Exit Play Mode
5. Observe the Console log
Expected result: Application.wantsToQuit event is raised before OnApplicationQuit, if false is returned, no GameObjects are destroyed
Actual result: OnApplicationQuit is called before Application.wantsToQuit event is raised. Even if Application.wantsToQuitt returns false, most GameObjects are still destroyed in the OnApplicationQuit method because is called before the Application.wantsToQuit event
Reproducible with: 2018.4.24f1, 2019.4.3f1, 2020.1.0b15, 2020.2.0a17
Notes:
- The issue is also reproducible on Windows and Mac player, which can be seen in the Player log
- Added a video for reference showing the behavior with GameObjects being destroyed, even if Application.wantsToQuit is false
-
SunnysideGames
Jan 19, 2023 07:45
Still the case in 2021.3.10f1. Had to modify many plugins and scripts in order to use wantsToQuit.
-
Baggers_
Jan 20, 2021 14:50
Can confirm this on 2020.2.0b11
Such a crazy bug, it makes wantsToQuit useless and means we need to modify all plugins that use OnApplicationQuit.How is this not considered a regression?
-
Palito_
Nov 13, 2020 17:31
Application.wantsToQuit does not work in editor, only in standalone.
-
jparedes90
Sep 28, 2020 06:28
I can confirm the issue. Looks like it stops working when you change to a different scene too.
-
ChaoFPS
Sep 01, 2020 12:01
I confirm the issue. Please fix this
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Rename is enabled on subfolder empty space - "Can't rename to empty name" warning
- SamplerState Property Missing Anisotropic Filtering
- Visual glitches when using Handles API
- The RGBA color values are inconsistent when comparing two identical colors set in the Inspector
- Weird behaviour in TextMeshPro Link Example sample when hovering over single letters after hovering over a word
Resolution Note (fix version 2021.1):
Fixed in: 2021.2.0a4
Resolution Note (fix version 2021.1):
Fixed in: 2021.1.0b10
Resolution Note (fix version 2020.3):
Fixed in: 2020.3.1f1
Resolution Note (fix version 2019.4):
Fixed in: 2019.4.22f1