Switch between scenes without reloading

Hi
My app is pretty large, and I have two scenes. The main guts of the app is all within a single scene (mainscene) where i show and hide different sections dependent on what is relevant. I have found this is far faster than creating multiple scenes reusing some rather large environment assets.

I have recently had to create a second scene (videoscene ) to play videos as the package I purchaed won’t work with this architecture

This means when the video finishes playing i switch back to mainscene. Is there a way to keep mainscene e.g. cached/in memory/something similar so i don’t experience such a long delay when switching back from the videoscene to mainscene

thanks

The most obvious thing would to just leave the main scene loaded. I don’t understand why you need to unload the main scene. Can you elaborate on that?

thanks for getting back to me
i guess that is a reflection of my ignorance:face_with_spiral_eyes:
I thought I had to switch scenes. How do I toggle between the two and keep them both loaded? At the moment I use this
SceneManager.LoadScene();

How can i keep both scenes loaded?

You can actually have multiple scenes open at the same time in Unity. You just need to open them in additive mode:

You can also open multiple scenes in the editor too, by right-clicking on the scene and selecting “open scene additive.” Multiple scenes are useful for a lot of things.

If you unload an additive scene, the assets used in that seen are not unloaded from memory, from what I understand. That video will probably take-up a big chunk of it, too. You may need to call Resources.UnloadUnusedAssets() additionally.

ok thanks - i am only looking to do this in the runtime app - will take a look at the resources and see if i can work it out
thanks for your help

According to this thread they are unloaded, as long as they’re actually ‘unused’ at that point: Question - Memory profiler; Textures remain in memory and point to references that have been destroyed? - Unity Forum

Edit: Although the docs for UnloadAsync state: Note: Assets are currently not unloaded. In order to free up asset memory call Resources.UnloadUnusedAssets.
Unity - Scripting API: SceneManagement.SceneManager.UnloadSceneAsync (unity3d.com)
So, lets keep it at ‘maybe’…

I didn’t actually state that there. There was a separate parallel thread, where the user had added a call to Resources.UnloadUnusedAssets in the callback to the scene unload.
SceneUnloads in Unity generally dont unload the unused assets from that scene (only the previous scene) unless explicitly asked to do so in the scene unload call.

Also, by default, only non-additive, destructive scene loads trigger Resources.UnloadUnusedAssets without explicitly specifying that. But they do so before they destroy everything in the scene so all assets still used then will not be unloaded.

Hi - i have just found a problem with using LoadSceneMode.Additive and am hoping you can help
I have a reticle pointer attached to my camera which is needed in both scenes.

If I use LoadSceneMode.Additive then both scenes are active and the reticle pointer doesn’t appear in the newly loaded scene, although i am getting the correct camera view. Do you have any suggestions on how i can fix this?

thanks