diff --git a/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs b/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs index ce01d32f7..ebc24fd2f 100644 --- a/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs +++ b/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; +using UnityEngine.ResourceManagement.ResourceProviders; using UnityEngine.SceneManagement; namespace DDD @@ -27,8 +28,6 @@ public void Init() public async void PostInit() { - SceneManager.Instance.OnSceneChanged += OnFlowSceneOpened; - try { if (IsGameStarted() == false) @@ -109,12 +108,6 @@ public void OpenFlowScene(GameFlowState newFlowState) } } - private Scene _currentScene; - public void OnFlowSceneOpened(Scene newScene) - { - _currentScene = newScene; - } - public bool GetFlowScene(GameFlowState flowState, out SceneType sceneType) { return GameFlowSceneMappingSo.FlowToSceneMapping.TryGetValue(flowState, out sceneType); diff --git a/Assets/_DDD/_Scripts/GameFramework/SceneManager.cs b/Assets/_DDD/_Scripts/GameFramework/SceneManager.cs index 7dfa1c17d..3bb19f9ad 100644 --- a/Assets/_DDD/_Scripts/GameFramework/SceneManager.cs +++ b/Assets/_DDD/_Scripts/GameFramework/SceneManager.cs @@ -3,7 +3,6 @@ using System.Threading.Tasks; using UnityEngine; using UnityEngine.ResourceManagement.ResourceProviders; -using UnityEngine.SceneManagement; namespace DDD { @@ -18,7 +17,9 @@ public class SceneManager : Singleton, IManager { private Dictionary _loadedScenes; - public Action OnSceneChanged; + private SceneInstance _currentSceneInstance; + + public Action OnSceneChanged; public void Init() { @@ -87,7 +88,7 @@ public void ActivateScene(SceneType sceneType) } UnityEngine.SceneManagement.SceneManager.SetActiveScene(sceneInstance.Scene); - OnSceneChanged?.Invoke(sceneInstance.Scene); + _currentSceneInstance = sceneInstance; } else {