Search Unity

[RELEASED] Additive Scene Manager

Discussion in 'Assets and Asset Store' started by Selzier, Nov 8, 2016.

  1. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652


    This asset provides a set of functions that simplifies the asynchronous loading and unloading of additive scenes. Includes a custom inspector to display which scenes are loading/loaded so it’s easy to understand what is happening with Unity's SceneManager and what loading stage each scene is at.

    The SceneController.cs class gives the ability to:
    - Add scenes that will be loaded when the game starts.
    - Add ‘persistent’ scenes that will not be unloaded by SceneController’s Unload functions.
    - View all scenes which are currently loaded by Unity’s SceneManager class.
    - View what loading stage each scene is at.
    - Set the allowSceneActivation boolean via toggle.
    - Load new scenes into the editor or at runtime.
    - Bake lighting on multiple scenes simultaneously via the Lightmapping.BakeMultipleScenes API function.

    A demo project is included and as well as a script to utilize the SceneController functions so you can get asynchronous additive scenes working in your project without using any code.

    Great setup for VR Cameras and scene loading.
     
  2. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Updated to 1.4
     
  3. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    With this asset is it possible to adaptively load scenes containing GameObjects that overlap?
    If so, how are overlapping collidiors treated? Do there interfere with each other?
     
  4. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Yes, you can load scenes with gameobjects that overlap. If you load scene A, and then scene B, and scene B has objects that overlap objects in Scene A, then there will be a collision between those objects. If they have rigidbodies, they will be pushed away from each other.
     
  5. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    What if there is a cube with collider and rigidbody in each scene in the same exact position...How will they be pushed away? Will one cube 'ride' on top of the other cube?
     
  6. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
  7. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Thanks! I bought it.
     
    Selzier likes this.
  8. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Cool, thanks for the support TokyoDan! You'll see in the demo scenes that I just added these cubes to 2 of the rooms, and the played the demo with 'PlayerCamera' as Active Scene.
     
  9. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Hey, I looked at your asset today and didn't see any reference to using Resources.UnloadUnusedAssets();

    How is your asset handling the releasing of memory after unloading scenes?

    Early profiling on the Oculus Quest shows memory being left behind after unloading scenes, we cannot reliably wait for Memory warnings in Unity to trigger a garbage collection or memory clear in VR as it causes awful hiccups.
     
  10. Immersive-Matthew

    Immersive-Matthew

    Joined:
    Mar 24, 2020
    Posts:
    137
    I purchased the Additive Scene Manager and got it all working on my project today. Thank you for the YouTube video, sample scene and solid documentation as it really helped me implement it fast. Upon testing I am noticing that while it is unloading scenes properly, it does not appear to be unloading the scenes memory usage. like Robyer1 I too am on the Oculus Quest but the results are similar in the player. Here are my tests on memory utilization:

    Test 1. I made a build with scenes 1, 2 and 3. Upon running the title moves through scene 1, then into 2 and finally 3 on a set track. When scene 3 is triggered to load, scene 1 unloads as expected leaving only scene 2 and 3 active with memory utilized at 1,800KB
    Test 2. I made another build but this time just scenes 2 and 3. Upon running the title moves through scene 2 and triggers scene 3 to load leaving scene 2 and 3 loaded which is the same as the final state in test 1, but the memory with both scenes loaded this time was only at 900KB.

    I spent all day trying to figure out why this is as your code is for sure unloading scene 1 in test 1 and thus the remaining memory usage should have been 900KB give or take. That said the total was 1,800KB which is the usage if ALL 3 scenes were loaded.

    I did a little digging in the Unity documentation and discovered I need to call Resources.UnloadUnusedAssets which when looking at your scripts, I cannot find. Surely when a scene is unloaded the memory it used is also unloaded right? Perhaps you are doing in a way that is deprecated in Unity 2020.19f1?.

    Thank you for your help.