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
|
// 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.
|
// 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()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
// Unsubscribe from SceneManagerService
|
// Unsubscribe from SceneManagerService
|
||||||
if (SceneManagerService.Instance != null)
|
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
|
// Ensure we clean up any subscriptions from registered items when the manager is destroyed
|
||||||
ClearAllRegistrations();
|
ClearAllRegistrations();
|
||||||
@@ -87,7 +87,7 @@ namespace Core
|
|||||||
_isQuitting = true;
|
_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
|
// Clear all registrations when a new scene is loaded, so no stale references persist
|
||||||
ClearAllRegistrations();
|
ClearAllRegistrations();
|
||||||
|
|||||||
Reference in New Issue
Block a user