Preliminary screen rotation work

This commit is contained in:
Michal Pikulski
2025-09-08 14:25:50 +02:00
parent 32888a6843
commit a1b1d7475f
15 changed files with 621 additions and 112 deletions

View File

@@ -201,6 +201,15 @@ public class SceneManagerService : MonoBehaviour
// Switches from current gameplay scene to a new one
public async Task SwitchSceneAsync(string newSceneName, IProgress<float> progress = null)
{
// Remove all AstarPath (A* Pathfinder) singletons before loading the new scene
var astarPaths = FindObjectsByType<AstarPath>(FindObjectsSortMode.None);
foreach (var astar in astarPaths)
{
if (Application.isPlaying)
Destroy(astar.gameObject);
else
DestroyImmediate(astar.gameObject);
}
// Load new scene
await LoadSceneAsync(newSceneName, progress);
// Unload previous scene (if not same)