Added early update event.

This commit is contained in:
2023-12-16 16:32:47 +01:00
parent 8dcb16073c
commit 5991e60e7a
3 changed files with 23 additions and 1 deletions

View File

@ -33,6 +33,14 @@ namespace Utils
GUILayout.Label(EventManager.LateUpdateLength.ToString()); GUILayout.Label(EventManager.LateUpdateLength.ToString());
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("EarlyUpdate");
if (Application.isPlaying)
{
GUILayout.FlexibleSpace();
GUILayout.Label(EventManager.EarlyUpdateLength.ToString());
}
GUILayout.EndHorizontal();
} }
} }
} }

View File

@ -13,8 +13,13 @@ namespace Utils
public delegate void LateUpdateAction(); public delegate void LateUpdateAction();
public static event LateUpdateAction LateUpdated; public static event LateUpdateAction LateUpdated;
public delegate void EarlyUpdateAction();
public static event EarlyUpdateAction EarlyUpdated;
private void Update() private void Update()
{ {
EarlyUpdated?.Invoke();
Updated?.Invoke(); Updated?.Invoke();
} }
@ -54,5 +59,14 @@ namespace Utils
return list?.Length ?? 0; return list?.Length ?? 0;
} }
} }
public static int EarlyUpdateLength
{
get
{
var list = EarlyUpdated?.GetInvocationList();
return list?.Length ?? 0;
}
}
} }
} }

View File

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