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

Scripting

-

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

  1. Response avatar

    Resolution Note (fix version 2021.1):

    Fixed in: 2021.2.0a4

  2. Response avatar

    Resolution Note (fix version 2021.1):

    Fixed in: 2021.1.0b10

  3. Response avatar

    Resolution Note (fix version 2020.3):

    Fixed in: 2020.3.1f1

  4. Response avatar

    Resolution Note (fix version 2019.4):

    Fixed in: 2019.4.22f1

Comments (4)

  1. 1da667e5526c815eb7650dc596c59745?d=mm

    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?

  2. 0d8c52d6a54340dbdd59c721a65ff7e9?d=mm

    Palito_

    Nov 13, 2020 17:31

    Application.wantsToQuit does not work in editor, only in standalone.

  3. E5ff7ddfe773b8251377ce80fb103e95?d=mm

    jparedes90

    Sep 28, 2020 06:28

    I can confirm the issue. Looks like it stops working when you change to a different scene too.

  4. 55a49e5bd4ea25b71d540352970d86af?d=mm

    ChaoFPS

    Sep 01, 2020 12:01

    I confirm the issue. Please fix this

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.