Update Puzzle Manager's initialization sequence
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using PuzzleS;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Manages puzzle step registration, dependency management, and step completion for the puzzle system.
|
||||
@@ -44,6 +45,18 @@ public class PuzzleManager : MonoBehaviour
|
||||
{
|
||||
_instance = this;
|
||||
// DontDestroyOnLoad(gameObject);
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
BuildRuntimeDependencies();
|
||||
UnlockInitialSteps();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -71,12 +84,6 @@ public class PuzzleManager : MonoBehaviour
|
||||
Debug.Log($"[Puzzles] Unregistered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}");
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
BuildRuntimeDependencies();
|
||||
UnlockInitialSteps();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the runtime dependency graph for all registered steps.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user