You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Debug.LogWarning("Tried to create an `AdvancedSceneManager` with all loaded scenes, but encoutered none. Did you create the scene manager on `Awake()`? If so, try moving the call to `Start()` instead.");
67
+
}
63
68
}
64
69
/// <summary>
65
70
/// Creates a new <see cref="AdvancedSceneManager"/> with the option to add a list of loaded scenes to its management.
@@ -635,6 +639,57 @@ The tests do not have any effect on a runtime build of the game, they only mean
635
639
636
640
[_[back to top]_](#advanced-scene-manager)
637
641
642
+
## Troubleshooting
643
+
644
+
### Error when creating an `AdvancedSceneManager`
645
+
646
+
When creating an `AdvancedSceneManager` passing a `true` value to its constructor, as `new AdvancedSceneManager(true)`, it attempts to add all loaded scenes to its list of tracked scenes.
647
+
However, if you called that during `Awake()`, you might see the error:
648
+
649
+
```
650
+
ArgumentException: Attempted to get an {nameof(ISceneData)} through an invalid or unloaded scene.
651
+
```
652
+
653
+
This error is thrown because during `Awake()` the scene is not fully loaded and cannot be added to the list of tracked scenes.
654
+
655
+
656
+
Move your call to `Start()` instead.
657
+
658
+
### Cannot unload a scene with a different `ILoadSceneInfo`
659
+
660
+
In a case where you have loaded a scene via one type of `ILoadSceneInfo`, you can only unload it by using the same type or explicitly a `LoadSceneInfoScene`. For example:
Sometimes this issue can also be avoided by performing a scene transition. If you're trying to unload the active scene to transition between scenes, you can execute the transition through the scene manager and let it handle the internal complexity. For example:
681
+
682
+
```cs
683
+
// Instead of unloading the source scene directly:
684
+
sceneManager.LoadSceneAsync(targetSceneInfo)
685
+
sceneManager.UnloadSceneAsync(sourceSceneInfo);
686
+
687
+
// Perform a scene transition:
688
+
sceneManager.TransitionToScene(targetSceneInfo);
689
+
```
690
+
691
+
[_[back to top]_](#advanced-scene-manager)
692
+
638
693
---
639
694
640
695
Don't hesitate to create [issues](https://github.com/mygamedevtools/scene-loader/issues) for suggestions and bugs. Have fun!
0 commit comments