diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 65d3ba30..65031fb0 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -91,6 +91,15 @@ namespace NewHorizons.Handlers // default to displaying nh planets if no title screen builders else DisplayBodiesOnTitleScreen(); + + try + { + Main.Instance.OnAllTitleScreensLoaded?.Invoke(); + } + catch (Exception e) + { + NHLogger.LogError($"Error in event handler for OnAllTitleScreensLoaded: {e}"); + } } public static void InitSubtitles() diff --git a/NewHorizons/INewHorizons.cs b/NewHorizons/INewHorizons.cs index 5031fb0f..b696926f 100644 --- a/NewHorizons/INewHorizons.cs +++ b/NewHorizons/INewHorizons.cs @@ -79,6 +79,11 @@ namespace NewHorizons /// Gives the unique name of the mod the title screen builder was from. /// UnityEvent GetTitleScreenLoadedEvent(); + + /// + /// An event invoked when NH has finished building the title screen. + /// + UnityEvent GetAllTitleScreensLoadedEvent(); #endregion #region Querying configs diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 3f25eb1d..3d0e95e9 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -112,6 +112,7 @@ namespace NewHorizons public StringEvent OnStarSystemLoaded = new(); public StringEvent OnPlanetLoaded = new(); public StringEvent OnTitleScreenLoaded = new(); + public UnityEvent OnAllTitleScreensLoaded = new(); /// /// Depending on platform, the AsyncOwnershipStatus might not be ready by the time we go to check it. diff --git a/NewHorizons/NewHorizonsApi.cs b/NewHorizons/NewHorizonsApi.cs index 5293c883..2c3d495b 100644 --- a/NewHorizons/NewHorizonsApi.cs +++ b/NewHorizons/NewHorizonsApi.cs @@ -91,6 +91,7 @@ namespace NewHorizons public UnityEvent GetStarSystemLoadedEvent() => Main.Instance.OnStarSystemLoaded; public UnityEvent GetBodyLoadedEvent() => Main.Instance.OnPlanetLoaded; public UnityEvent GetTitleScreenLoadedEvent() => Main.Instance.OnTitleScreenLoaded; + public UnityEvent GetAllTitleScreensLoadedEvent() => Main.Instance.OnAllTitleScreensLoaded; public bool SetDefaultSystem(string name) {