Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Advanced Multi-Scene - Now Available

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

  1. Hannibal_Leo

    Hannibal_Leo

    Joined:
    Nov 5, 2012
    Posts:
    263
    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:
    21
    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:
    21
    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:
    21
    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.
     
unityunity