Clear all event subscriptions on application shutdown.

This commit is contained in:
Alexander Filippov 2024-07-27 15:12:40 +02:00
parent 10310ba36b
commit dbac051fc2
3 changed files with 14 additions and 1 deletions

View File

@ -34,6 +34,14 @@ namespace Utils
LastUpdated?.Invoke();
}
private void OnApplicationQuit()
{
Updated = null;
LateUpdated = null;
EarlyUpdated = null;
LastUpdated = null;
}
public static Delegate[] EarlyUpdateDelegates => EarlyUpdated?.GetInvocationList();
public static int EarlyUpdateLength => EarlyUpdateDelegates?.Length ?? 0;

View File

@ -14,6 +14,11 @@ namespace Utils
FixedUpdated?.Invoke();
}
private void OnApplicationQuit()
{
FixedUpdated = null;
}
public static Delegate[] FixedUpdateDelegates => FixedUpdated?.GetInvocationList();
public static int FixedUpdateLength => FixedUpdateDelegates?.Length ?? 0;

View File

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