Preliminary screen rotation work
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user