Hi All,
at start up I load a lot of scenes using LoadSceneAsync
for( int i = 0; i < gameScenes.Length; i++ )
{
string name = directory + gameScenes[ i ].SceneName;
SceneManager.LoadSceneAsync( name, LoadSceneMode.Additive );
}
I do this for speed so every scene is loaded into memory at the start then I can flick between then. However I don’t know how to set scenes active and inactive? What I’d like to do is set every scene inactive after the loadsceneasync. Then set then active when when needed. I can see SceneManager.SetActiveScene however I can’t work out how to turn of off. Can anyone advise please?
I don’t think the new system is setup to do what you want. As I understand it, SetActiveScene only sets which scene gets new instantiations and stuff, it doesn’t actually enable/disable any objects in the scene, you would need to do that manually. There is an UnloadSceneAsync, which destroys all objects from a specific scene but keeps the assets in memory, with that you’d need to reload the scene you want to be active but as the assets are already in memory it shouldn’t take long at all.
Put everything in the scene as a child of a GameObject and use SetActive on that game object. You can’t activate and deactivate entire scenes at a time.
1 Like
Thanks, used the “master” object and made inactive. Works, but I’d have thought with multi scenes now avalible Unity would have made them like an object to just make active or inactive
1 Like