Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Advanced Multi-Scene - Now Available

Discussion in 'Assets and Asset Store' started by Jodon, Feb 2, 2016.

  1. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    646
    Thinking of buying this but the asset-store page does not provide a lot of information and this 5 pages long support thread contains a lot of useless information, like problems someone had in Unity Version 5.
    Could you sum up all the features and limitations? Timeline Support is a huge one. Referencing components individually is now possible? ("you can (cross-)reference two Colliders on one GameObject" - Jodon) Does this only work for a list or for individual references too (like picking the thrid of five colliders)?

    On the asset-store page:
    "
    ● Automatic save & restore of cross-scene references in the editor AND at runtime, allowing a reference from Scene-A to correctly reference an object in Scene-B.
    ● Ability to 'bake' (merge) a sub-scene into your main scene at build-time, reducing load times and alleviating order-dependent script issues.
    ● Automatic save and restore of your multi-scene setup in editor
    ● Automatic load of your scene setup at runtime (with options on how to load)
    "

    one limitation seems to be that cross-scene-references only work, when the GameObjects have distinctive names
    Would the following Hierarchy-Setup work:
    -Car
    --front left
    ---wheel (Cross-Scene-Reference 1)
    --front right
    ---wheel (Cross-Scene-Reference 2)
    ?

    Is the Light Baking and NavMesh Baking automated or do I have to do something manually to bake those?

    (I want to use this with Unity 2020.1)
     
    Last edited: Aug 1, 2020
  2. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    434
    I've mulled this over for a while. My solution is to change the _isMainScene variable to now be a _sceneSetupMode variable. There's basically three modes:
    1. Automatic. This is what you describe: The Scene Setup is automatically updated and saved if this is the Active Scene you are saving.
    2. Manual. This is never updating the Scene Setup unless you put in the entries manually. Typically you switch it to this mode once you've already done your Scene Setup with Automatic mode.
    3. Disabled. You use this for the SubScenes. They never pull in other scenes.
    I've rewritten the save pipeline so I'd like to test it a bit more against newer versions of Unity before I roll it out. If you want a preview build, I can send you a link. Cheers.
     
  3. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    434
    Hey Hannibal_Leo,

    As you can tell, I often miss updates to this thread (it's actually a forum bug that I don't get e-mails) and unfortunately I no longer develop in Unity full time. Having said that, I do try to provide support for those who need it.

    To answer your questions: The full features and limitations are essentially that you can do cross-scene referencing like the scenarios described. Yes, you can cross-reference the third of five colliders (the system works automatically* more on this in a bit). Yes, the scenario you described with the hierarchy also works because the cross scene references are a unique path in the hierarchy (e.g. Car/Front Left/Wheel vs. Car/Front Right/Wheel). It can't distinguish between two identical paths.

    The Light Baking and NavMesh Baking are supported, but there is no special code in my plug-in to support it. That basically means you're at Unity's mercy for the workflow they support. Years ago it was bad and changing with every Unity version. I believe it's mostly fixed now, and if you use 'additively' load the baked scenes things should work out smoothly -- using the 'Baked' feature where scene geometry would auto-merge has been an issue in the past that Unity has broken and fixed many times so it really depends on what version of Unity you're using for that particular feature.

    Finally, the one caveat with using the system is that it doesn't solve any ordering problems for you. Say you have Scene A that cross-references an Object in Scene B. Well you won't be able to actually use that reference in Scene A until Scene B is fully loaded (it can be null for a few frames while Scene B loads in). To get around most of these issues, I tend to not put any usage of those variables in Awake() or OnEnable() and prefer to delay using them until Start() in my MonoBehaviours.
     
  4. lordzeon

    lordzeon

    Joined:
    Jun 1, 2018
    Posts:
    44
    Hi, im interested in buying this asset if it suit my need. I have just 2 scenes, a menu that should load as fast as possible, and a heavy scene, after some setup in the menu scene, the user play the heavy scene, but after that, both should be accesible fast. I´ve already tried to load that scene in Additive mode but i had many problems, some managers in the menu need the references to the heavy scene, so just having those references without use was a problem and setting them after the scene load was even more painful because of the state machine i use, after fighting with all those problems i discarded the idea to divide the scene and now i have a very heavy scene that takes ages to load, so my need is to load the first menu scene AFAP and load the heavy scene async while the user work in the first menu scene, i understand that with this asset the references to the heavy scene won´t be lost, but im wondering:

    What happens if the second scene is loading async and i try to use a reference to the second scene? will it hang until the scene is loaded or throw a error?
     
  5. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    434
    It will throw an error (it will be null until the scene is loaded in). I of course would advocate for more than two scenes, especially if one takes forever to load. You should break it into small scenes and load them in only as needed.

    However, if you're set on just having the two scenes and only a few references, you could try this strategy: Find the GameObject which contains the objects you wanna hook up, and then send a BroadcastMessage("OnHookupReferencesFromMenu", MenuGameObject) or something similar down the hierarchy. That will let any subscribers know that your scene is loaded and it's safe to hook-up those references. That could work if your hierarchy is shallow and all of the references that need to be hooked-up live within a hierarchy. You only pay that cost once. Of course my plug-in is a bit more sophisticated than that, but if your project is simple enough that could save you some money if that's a concern.

    Cheers.
     
  6. realcosmik

    realcosmik

    Joined:
    Nov 27, 2018
    Posts:
    20
    Hi, im interested in buying this plugin I recently read through this forum and am surprised to see that nobody has mentioned anything about performance. What is the overhead cost of using this plugin and how does that overhead scale?
     
  7. realcosmik

    realcosmik

    Joined:
    Nov 27, 2018
    Posts:
    20
    Hey, went ahead and bought the plugin, great work I love it! still wondering about the overhead. Also there seems to be a bug in the AmsHierarchyDrawer where you can only change the change the loadtypes when the active scene is dirty. I dont know if it is by design in unity that the Editorgui ChangeCheck Methods only work when the Hierarchy is dirty. for anyone that many need here is my fix for it. I used a GUI dropdown button and genericmenu to set the enum instead of the EditorGui Enum popups
     
  8. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    434
    Hey, sorry I didn't get back to you. As you can probably tell, the overhead is minimal. You'll get the cost of a few FindChild calls plus a reflection lookup to set the reference on the Awake when loading a scene. This will be dwarfed by all other internal functions that it takes to instantiate then objects when loading a scene.

    I noticed Unity broke their GUI code in late 2019. I haven't reported a bug to them. I'll take a look at the fix this weekend.

    Cheers.
     
  9. realcosmik

    realcosmik

    Joined:
    Nov 27, 2018
    Posts:
    20
    upload_2020-11-26_18-53-46.png

    Yeah good point I forgot to report a this bug to unity also because it deffinitly is. The original way it is written in the AmsHierarchyDrawer.cs should work but for some reason the editorgui.endchangecheck() was always returning false so the field never gets updated. I changed it to create a generic menu to manually create the drop down window and set the callbacks on click. the "contentTypeNames" array are cached GuiContent pointers with the names of the enums.
     
  10. fbmd

    fbmd

    Joined:
    Dec 4, 2016
    Posts:
    16
    Does this asset also allow to reference scene objects from assets, e.g. ScriptableObjects?
     
  11. mk_dev

    mk_dev

    Joined:
    Mar 7, 2017
    Posts:
    2
    Using this in Unity 2020.3. I cant set scenes manually, and "Dont Load" seems broken - it loads all the child scenes whether the loadtype is set correctly or not.
     
    Last edited: Jul 28, 2021
  12. najati

    najati

    Joined:
    Oct 23, 2017
    Posts:
    41
    This assets seems pretty handy. Curious about how quiet the thread is and that codingjar.com seems to be offline.

    Did Unity bake something in that made this obsolete? Is there a better option these days? Is this asset still actively supported?

    Cheers!
     
    avataris-io likes this.
  13. looytroop

    looytroop

    Joined:
    Jun 22, 2017
    Posts:
    69
    I still use and love this asset to this day. I mostly work in LTS 2019. But I'm using it in a 2020 LTS project as well. Don't know about the 2021 versions of Unity.
     
  14. avataris-io

    avataris-io

    Joined:
    Jun 23, 2020
    Posts:
    37
    Hi!

    Thanks a lot for your asset, it's very helpful:)

    Are you planning to make an update for it to support new Unity versions (2021.1, 2021.2, 2022.X)? It would be great to get an update since Unity changed some API in new unity versions)

    Best regards,
    Michael Schoeggl
     
  15. TsvetanVasilev

    TsvetanVasilev

    Joined:
    Aug 10, 2022
    Posts:
    2
    Hi,
    What is the best approach to track progress of loading scenes using this plugin. Right now I have one scene for loading screen (in which I have the loading progress bar), which then loads the main scene through code. Then the plugin loads the rest of the scenes additive (the rest of the scenes are in the AMS Scene setup).

    With this setup the loading screen is completely black and does not show anything until the main scene is loaded.
     
  16. jortcontrollab

    jortcontrollab

    Joined:
    Dec 13, 2022
    Posts:
    1
    Dear Jodon

    When I try to make a build for a simple test project in Unity 2020.3.22f1 I get allot of warnings. Mainly about not allowing of finding cross scene references. The resulting build does seem to work

    In a bigger project where I am using the plugin I have an issue but I cannot find the error because of the large amounts of warnings. There are no warnings when entering play mode for both of my projects.

    Is there a way to fix these warnings during building an excecutable?

    Code (CSharp):
    1. Cross scene references are not supported: 'Main Camera' in scene SampleScene has an invalid reference to 'Cylinder' in scene SecondScene. This reference will not be saved in the scene.
    2. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    3.  
    4. 'Cylinder' in scene SecondScene (click to ping it)
    5. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    6.  
    7. Cross scene references are not supported: 'Directional Light' in scene SecondScene has an invalid reference to 'Sphere' in scene SampleScene. This reference will not be saved in the scene.
    8. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    9.  
    10. 'Sphere' in scene SampleScene (click to ping it)
    11. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    12.  
    13. Assets\Plugins\CodingJar\MultiScene\Scripts\AmsMultiSceneSetup.cs(94,41): warning CS0414: The field 'AmsMultiSceneSetup._sceneSetupMode' is assigned but its value is never used
    14.  
    15. Did not resolve Cross-Scene Reference during build: Main Camera (NewBehaviourScript).thisCylinder => SecondScene'/Cylinder' (GameObject #0)
    16. UnityEngine.Debug:LogWarningFormat (string,object[])
    17. CodingJar.MultiScene.AmsCrossSceneReferences:EditorWarnOnUnresolvedCrossSceneReferences () (at Assets/Plugins/CodingJar/MultiScene/Scripts/AmsCrossSceneReferences.cs:420)
    18. CodingJar.MultiScene.Editor.AmsScenePostProcessor:WarnOnAllMissingCrossSceneRefs () (at Assets/Plugins/CodingJar/MultiScene/Editor/AmsScenePostProcessor.cs:169)
    19. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    20.  
    21. Previous Cross-Scene Reference Errors were in Assets/Scenes/SampleScene.unity
    22. UnityEngine.Debug:LogWarningFormat (string,object[])
    23. CodingJar.MultiScene.Editor.AmsScenePostProcessor:WarnOnAllMissingCrossSceneRefs () (at Assets/Plugins/CodingJar/MultiScene/Editor/AmsScenePostProcessor.cs:171)
    24. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    25.  
    26. Did not resolve Cross-Scene Reference during build: Directional Light (SecondScript).thisSphere => SampleScene'/Sphere' (GameObject #0)
    27. UnityEngine.Debug:LogWarningFormat (string,object[])
    28. CodingJar.MultiScene.AmsCrossSceneReferences:EditorWarnOnUnresolvedCrossSceneReferences () (at Assets/Plugins/CodingJar/MultiScene/Scripts/AmsCrossSceneReferences.cs:420)
    29. CodingJar.MultiScene.Editor.AmsScenePostProcessor:WarnOnAllMissingCrossSceneRefs () (at Assets/Plugins/CodingJar/MultiScene/Editor/AmsScenePostProcessor.cs:169)
    30. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    31.  
    32. Previous Cross-Scene Reference Errors were in Assets/Scenes/SecondScene.unity
    33. UnityEngine.Debug:LogWarningFormat (string,object[])
    34. CodingJar.MultiScene.Editor.AmsScenePostProcessor:WarnOnAllMissingCrossSceneRefs () (at Assets/Plugins/CodingJar/MultiScene/Editor/AmsScenePostProcessor.cs:171)
    35. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
    36.  
    37.  
     

    Attached Files:

    xenotime likes this.