Fix initialization order for the manager objects

This commit is contained in:
Michal Pikulski
2025-10-16 11:46:51 +02:00
parent cb628ad5d6
commit 49c4d968aa
3 changed files with 36 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using Interactions;
using Bootstrap;
namespace Core
{
@@ -63,13 +64,21 @@ namespace Core
void Awake()
{
_instance = this;
// Register for post-boot initialization
BootCompletionService.RegisterInitAction(InitializePostBoot);
}
void Start()
{
// SceneManagerService subscription moved to InitializePostBoot
}
private void InitializePostBoot()
{
// 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.SceneLoadStarted += OnSceneLoadStarted;
Logging.Debug("[ItemManager] Subscribed to SceneManagerService events");
}
void OnDestroy()