diff --git a/Assets/Scripts/Behaviours/Loader.cs b/Assets/Scripts/Behaviours/Loader.cs index b0dc4dab..0f80b7c0 100644 --- a/Assets/Scripts/Behaviours/Loader.cs +++ b/Assets/Scripts/Behaviours/Loader.cs @@ -71,6 +71,8 @@ namespace SanAndreasUnity.Behaviours public static event System.Action onLoadSpecialTextures = delegate { }; + public static event System.Action onLoadingFinished = delegate { }; + protected override void OnSingletonStart() @@ -149,6 +151,8 @@ namespace SanAndreasUnity.Behaviours if (s_coroutine != null) CoroutineManager.Stop(s_coroutine); s_coroutine = null; + + F.InvokeEventExceptionSafe(onLoadingFinished); } @@ -237,6 +241,8 @@ namespace SanAndreasUnity.Behaviours Debug.Log("GTA loading finished in " + stopwatch.Elapsed.TotalSeconds + " seconds"); + F.InvokeEventExceptionSafe(onLoadingFinished); + // notify all scripts F.SendMessageToObjectsOfType( "OnLoaderFinished" ); diff --git a/Assets/Scripts/Editor/EditorLoader.cs b/Assets/Scripts/Editor/EditorLoader.cs index 9f68dd7b..62939def 100644 --- a/Assets/Scripts/Editor/EditorLoader.cs +++ b/Assets/Scripts/Editor/EditorLoader.cs @@ -14,6 +14,9 @@ namespace SanAndreasUnity.Editor { EditorApplication.update -= EditorUpdate; EditorApplication.update += EditorUpdate; + + Loader.onLoadingFinished -= OnLoadingFinished; + Loader.onLoadingFinished += OnLoadingFinished; } static void EditorUpdate() @@ -32,6 +35,11 @@ namespace SanAndreasUnity.Editor } } + static void OnLoadingFinished() + { + EditorUtility.ClearProgressBar(); + } + [MenuItem(EditorCore.MenuName + "/" + "Load game data")] static void MenuItemLoadGameData() {