Bootstrap initialization order figured out and provided events + dispatchers

This commit is contained in:
Michal Pikulski
2025-10-16 11:26:53 +02:00
parent b229e1aead
commit cb628ad5d6
4 changed files with 196 additions and 1 deletions

View File

@@ -94,6 +94,19 @@ namespace Bootstrap
CurrentProgress = 1f;
OnBootProgressChanged?.Invoke(1f);
OnBootCompleted?.Invoke();
// Notify the BootCompletionService that boot is complete
if (Application.isPlaying)
{
// We use reflection to avoid direct reference in case the service is disabled/removed
var type = System.Type.GetType("Bootstrap.BootCompletionService, Assembly-CSharp");
if (type != null)
{
var method = type.GetMethod("HandleBootCompleted",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
method?.Invoke(null, null);
}
}
}
/// <summary>
@@ -106,6 +119,19 @@ namespace Bootstrap
CurrentProgress = 1f;
OnBootProgressChanged?.Invoke(1f);
OnBootCompleted?.Invoke();
// Notify the BootCompletionService that boot is complete
if (Application.isPlaying)
{
// We use reflection to avoid direct reference in case the service is disabled/removed
var type = System.Type.GetType("Bootstrap.BootCompletionService, Assembly-CSharp");
if (type != null)
{
var method = type.GetMethod("HandleBootCompleted",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
method?.Invoke(null, null);
}
}
}