stash work
This commit is contained in:
@@ -12,23 +12,10 @@ namespace UI
|
||||
private static PauseMenu _instance;
|
||||
private static bool _isQuitting;
|
||||
|
||||
public static PauseMenu Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null && Application.isPlaying && !_isQuitting)
|
||||
{
|
||||
_instance = FindAnyObjectByType<PauseMenu>();
|
||||
if (_instance == null)
|
||||
{
|
||||
var go = new GameObject("PauseMenu");
|
||||
_instance = go.AddComponent<PauseMenu>();
|
||||
// DontDestroyOnLoad(go);
|
||||
}
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Singleton instance of the PauseMenu. No longer creates an instance if one doesn't exist.
|
||||
/// </summary>
|
||||
public static PauseMenu Instance => _instance;
|
||||
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject pauseMenuPanel;
|
||||
@@ -52,23 +39,21 @@ namespace UI
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Subscribe to scene loaded events
|
||||
SceneManagerService.Instance.SceneLoadCompleted += SetPauseMenuByLevel;
|
||||
|
||||
// SceneManagerService subscription moved to InitializePostBoot
|
||||
|
||||
// Set initial state based on current scene
|
||||
SetPauseMenuByLevel(SceneManager.GetActiveScene().name);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR
|
||||
// Initialize pause menu state
|
||||
HidePauseMenu(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Subscribe to scene loaded events
|
||||
SceneManagerService.Instance.SceneLoadCompleted += SetPauseMenuByLevel;
|
||||
#endif
|
||||
|
||||
Logging.Debug("[PauseMenu] Subscribed to SceneManagerService events");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user