Use quitting instead of on application quit.

This commit is contained in:
2025-10-05 21:20:43 +02:00
parent 5f0b8a2a11
commit 7cd4614beb
3 changed files with 23 additions and 3 deletions

View File

@@ -4,6 +4,16 @@ namespace Utils
{ {
public class EventManager : MonoBehaviour public class EventManager : MonoBehaviour
{ {
private void Awake()
{
Application.quitting += OnQuitting;
}
private void OnDestroy()
{
Application.quitting -= OnQuitting;
}
private void Update() private void Update()
{ {
App.InvokeEarlyUpdate(); App.InvokeEarlyUpdate();
@@ -16,7 +26,7 @@ namespace Utils
App.InvokeLastUpdate(); App.InvokeLastUpdate();
} }
private void OnApplicationQuit() private void OnQuitting()
{ {
App.ClearUpdate(); App.ClearUpdate();
App.ClearLateUpdate(); App.ClearLateUpdate();

View File

@@ -4,12 +4,22 @@ namespace Utils
{ {
public class PhysicsEventManager : MonoBehaviour public class PhysicsEventManager : MonoBehaviour
{ {
private void Awake()
{
Application.quitting += OnQuitting;
}
private void OnDestroy()
{
Application.quitting -= OnQuitting;
}
private void FixedUpdate() private void FixedUpdate()
{ {
App.InvokeFixedUpdate(); App.InvokeFixedUpdate();
} }
private void OnApplicationQuit() private void OnQuitting()
{ {
App.ClearFixedUpdate(); App.ClearFixedUpdate();
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "ru.shazbot.utils", "name": "ru.shazbot.utils",
"version": "7.0.0", "version": "7.0.1",
"displayName": "Utils", "displayName": "Utils",
"description": "Utility useful for almost any project.", "description": "Utility useful for almost any project.",
"licensesUrl": "https://git.shazbot.ru/shazbot/Utils/src/LICENSE.md", "licensesUrl": "https://git.shazbot.ru/shazbot/Utils/src/LICENSE.md",