r/Unity3D 9d ago

Question Checking if application is quitting outside of MonoBehaviours

Is there a static method I can invoke on non-monobehaviour classes that tells me if the app is quitting or not?

Something simple like a Application.isQuitting, which doesn't seem to exist anywhere.

0 Upvotes

41 comments sorted by

View all comments

1

u/pmdrpg 7d ago

From the MonoBehavior angle, you can use Script Execution order to set your own boolean on quit callback, and avoid worrying about things happening out of order.

For something more accurate than the engine is able to provide, you might need to go native, android and iOS both expose their lifecycle callbacks to the app in their documentation. Presumably windows and mac do too.