All working with the build - update initialization order for the ItemManager
This commit is contained in:
@@ -69,14 +69,14 @@ namespace Core
|
||||
{
|
||||
// Subscribe to scene load completed so we can clear registrations when scenes change
|
||||
// Access Instance directly to ensure the service is initialized and we get the event hookup.
|
||||
SceneManagerService.Instance.SceneLoadCompleted += OnSceneLoadCompleted;
|
||||
SceneManagerService.Instance.SceneLoadStarted += OnSceneLoadStarted;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
// Unsubscribe from SceneManagerService
|
||||
if (SceneManagerService.Instance != null)
|
||||
SceneManagerService.Instance.SceneLoadCompleted -= OnSceneLoadCompleted;
|
||||
SceneManagerService.Instance.SceneLoadStarted -= OnSceneLoadStarted;
|
||||
|
||||
// Ensure we clean up any subscriptions from registered items when the manager is destroyed
|
||||
ClearAllRegistrations();
|
||||
@@ -87,7 +87,7 @@ namespace Core
|
||||
_isQuitting = true;
|
||||
}
|
||||
|
||||
private void OnSceneLoadCompleted(string sceneName)
|
||||
private void OnSceneLoadStarted(string sceneName)
|
||||
{
|
||||
// Clear all registrations when a new scene is loaded, so no stale references persist
|
||||
ClearAllRegistrations();
|
||||
|
||||
Reference in New Issue
Block a user