diff --git a/Editor/EventManagerEditor.cs b/Editor/EventManagerEditor.cs index 584891e..e850bb9 100644 --- a/Editor/EventManagerEditor.cs +++ b/Editor/EventManagerEditor.cs @@ -33,6 +33,14 @@ namespace Utils GUILayout.Label(EventManager.LateUpdateLength.ToString()); } GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.Label("EarlyUpdate"); + if (Application.isPlaying) + { + GUILayout.FlexibleSpace(); + GUILayout.Label(EventManager.EarlyUpdateLength.ToString()); + } + GUILayout.EndHorizontal(); } } } diff --git a/Runtime/EventManager.cs b/Runtime/EventManager.cs index df5b373..0d7ba90 100644 --- a/Runtime/EventManager.cs +++ b/Runtime/EventManager.cs @@ -12,9 +12,14 @@ namespace Utils public delegate void LateUpdateAction(); public static event LateUpdateAction LateUpdated; + + public delegate void EarlyUpdateAction(); + public static event EarlyUpdateAction EarlyUpdated; + private void Update() { + EarlyUpdated?.Invoke(); Updated?.Invoke(); } @@ -54,5 +59,14 @@ namespace Utils return list?.Length ?? 0; } } + + public static int EarlyUpdateLength + { + get + { + var list = EarlyUpdated?.GetInvocationList(); + return list?.Length ?? 0; + } + } } } diff --git a/package.json b/package.json index 213061f..b8c19fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ru.shazbot.utils", - "version": "5.1.0", + "version": "5.2.0", "displayName": "Utils", "description": "Utility useful for almost any project.", "licensesUrl": "https://git.shazbot.ru/Utils.git/tree/LICENSE.md",