Search Unity

Advanced Multi-Scene - Now Available

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

  1. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    If you send me a small case that demonstrates this, I will verify it. Cheers.
     
  2. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    411
    There is an minimal example called
    Scenes/Foundation

    Scenes/Foundation
    • This is the scene you transition to from Bootstrap.
    • "Load *" buttons will open other scenes additively.
    • "Unload *" buttons will unload scenes that have been additively loaded.
    on
    https://github.com/Unity-Technologies/Addressables-Sample.

    This is the exactly the method i use.

    Also some other nice little demos.
    You can find and install Adressables in the PackeManager.
     
  3. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Hey KeepOnShading,

    I've tried the example and it does work, but there are some caveats. Right now, all of the cross-scene references are saved via scene name. There's code that detects a rename and hooks everything up again, but if your intent is to rename your scene a bunch of times that's inadvisable but not impossible. The other thing is that because of this, we're not using the Addressables system specifically -- your code would be in charge of loading the desired scene, and AMS would then check to see if any of its cross-scene reference scenes are open, and if so, hook-up the references.

    I'm not sure what you're intending to achieve with the Addressable system, but I hope that answers your questions.
     
  4. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    411
    Thanks for checking. I will purchase and try.
    I mainly started with adressables to handle the 4GB problem on builds and finally it became a stable solution.
    Main XR Scene loads additive very big addressable production cars (around 4GB each) and environments. Historically the are some functions in these car who are referencing to main scene objects or environment. For these your cross scene references could be a temp solution.
     
  5. armnotstrong

    armnotstrong

    Joined:
    Mar 3, 2017
    Posts:
    18
    Hi,

    we find that cross scene reference of Camera not working. but other gameobject's cross scene reference works just fine



    After running in the editor

     
    keeponshading likes this.
  6. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Hello Armnotstrong,

    Thanks for the comprehensive bug report. The issue in this case is described in this post. A work-around is in the same post. I'll consider adding this to the list of expansion code that's currently being used for Timeline / Cinemachine.
     
    keeponshading likes this.
  7. mr_blahblah

    mr_blahblah

    Joined:
    Jan 15, 2016
    Posts:
    25
    Hey!

    I'm a long-time user and admirer of this package, never had any problems until Unity 2018.3.11f1, but now I have massively long load times (feels as if Unity is freezing or crashing), and the console yields a 'The scene is not loaded' error.

    The Cross Scene References components are all unticked on scene load as well, for some reason. Any ideas?


    ArgumentException: The scene is not loaded.
    UnityEngine.SceneManagement.Scene.GetRootGameObjects (System.Collections.Generic.List`1[T] rootGameObjects) (at C:/buildslave/unity/build/Runtime/Export/SceneManager/Scene.cs:91)
    CodingJar.GameObjectEx.GetRootObjectsEvenIfNotLoaded (UnityEngine.SceneManagement.Scene scene) (at Assets/Packages/CodingJar/Common/GameObjectEx.cs:100)
    CodingJar.GameObjectEx.FindBySceneAndPath (UnityEngine.SceneManagement.Scene scene, System.String absolutePath) (at Assets/Packages/CodingJar/Common/GameObjectEx.cs:157)
    CodingJar.MultiScene.UniqueObject.RuntimeResolve () (at Assets/Packages/CodingJar/MultiScene/Scripts/UniqueObject.cs:88)
    CodingJar.MultiScene.UniqueObject.Resolve () (at Assets/Packages/CodingJar/MultiScene/Scripts/UniqueObject.cs:132)
    CodingJar.MultiScene.RuntimeCrossSceneReference.get_fromObject () (at Assets/Packages/CodingJar/MultiScene/Scripts/RuntimeCrossSceneReference.cs:70)
    CodingJar.MultiScene.AmsCrossSceneReferences.ConditionalResolveReferences (System.Collections.Generic.List`1[T] references) (at Assets/Packages/CodingJar/MultiScene/Scripts/AmsCrossSceneReferences.cs:259)
    CodingJar.MultiScene.AmsCrossSceneReferences.ResolvePendingCrossSceneReferences () (at Assets/Packages/CodingJar/MultiScene/Scripts/AmsCrossSceneReferences.cs:240)
    CodingJar.MultiScene.AmsCrossSceneReferences.Awake () (at Assets/Packages/CodingJar/MultiScene/Scripts/AmsCrossSceneReferences.cs:132)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
  8. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Hello Mr Blahblah,

    I'm at a trade show until Friday this week, so can't take a good look at it until then. That said, I have active projects on 2018.3.10 without any issues. It's possible some internal functionality has changed. What I would recommend trying is looking at the GetRootObjectsEvenIfNotLoaded code and trying the pre-2017 path (using the reflection call). If that doesn't solve it, try re-ticking the components and resaving.

    If you can send me a small repro case I can look at what's going on, but probably on Friday rather than sooner.

    Cheers.
     
  9. Bubsavvy

    Bubsavvy

    Joined:
    Sep 18, 2017
    Posts:
    41
    Hey Jodon,

    I am not sure what happened, but as of Unity 2019.1.0f2 the UI Element build for setting scene types : Dont Load, Additive, etc. is broken. We cannot change these options now. No errors in the console to report. Just not doing the expected behavior.

    Thanks,
    Bubsavvy
     
  10. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Hey, I'm traveling in rural Japan at the moment, so WiFi isn't great. It will be a few days before I can grab that version of Unity. In the meantime, can you just use the Inspector to set those settings? You'll find them on the ! AmsMultiSceneSetup GameObject.
     
  11. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    47
    unity 2019 has subscene, when I create a subscene it added a AmsMultiscenesetup to it, now the scene is confused which scene depend which scene.
     
  12. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    There's a checkbox on the MonoBehaviour that says it it's the Main Scene or not. You want to uncheck it for the sub scenes.
     
  13. Bubsavvy

    Bubsavvy

    Joined:
    Sep 18, 2017
    Posts:
    41
    Hey Jodon,

    As of Unity Version 2019.1.10f1 we cannot save scenes with cross scene references. This occurs even without adding/modifying/removing cross scene references. A simple scene edit causes it like adding a new gameobject to the scene. The error is the following :

    Assertion failed on expression: 'm_SerializedObject->m_SerializedObjectVersion == m_SerializedObjectVersion'
    UnityEditor.SerializedProperty:get_objectReferenceInstanceIDValue()
    CodingJar.MultiScene.Editor.AmsSaveProcessor:HandleCrossSceneReferences(IList`1) (at Assets/CodingJar/MultiScene/Editor/AmsSaveProcessor.cs:125)
    CodingJar.MultiScene.Editor.AmsSaveProcessor:EditorSceneManager_sceneSaving(Scene, String) (at Assets/CodingJar/MultiScene/Editor/AmsSaveProcessor.cs:27)
    UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
     
  14. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Hey Bubsavvy,

    What version did you upgrade from? I've just run the testbed on 2019.2.0b7 and I'm not receiving any of these issues. I'll upgrade to the latest 2019.2 but I'm wondering if a bug snuck into 2019.1.10 seeing as it was only released a few days ago.

    Edit: I've confirmed it's a bug in the latest Unity. You can try to work-around it by modifying this code:

    Around the exception (AmsSaveProcessor.cs line 125) change to:

         
    var obj = xRef.fromProperty.objectReferenceValue;
    refIdToRestore = obj ? obj.GetInstanceID() : 0;
    xRef.fromProperty.objectReferenceInstanceIDValue = 0;
    xRef.fromProperty.serializedObject.ApplyModifiedPropertiesWithoutUndo();
     
    Last edited: Jul 15, 2019
  15. Bubsavvy

    Bubsavvy

    Joined:
    Sep 18, 2017
    Posts:
    41
    Hey Jodon,

    I upgraded from 2019.1.9f.

    Thanks for the update.
     
  16. Bubsavvy

    Bubsavvy

    Joined:
    Sep 18, 2017
    Posts:
    41
    I just checked the patch. Doesn't seem to fix it.
     
  17. Bubsavvy

    Bubsavvy

    Joined:
    Sep 18, 2017
    Posts:
    41
    Hey @Jodon,

    It was actually an issue with unity prefabs ultimately. The error still occurs, but the save issue is Unity Prefab related. Just letting you know.

    Thanks for looking into it,
    TrollHouseGames
     
  18. malyKuba

    malyKuba

    Joined:
    Jan 30, 2013
    Posts:
    5
    Hi, first of all - super helpful plugin. Keep it up :)

    I have problem that bothers me for some time now. Sometimes when I change value in inspector and save scene I get this error (especially when I change Controller on Animator. That's super strange...):
    I can press play, but when I do, I get hundreds of errors like this:
    and very often some game objects in scene just disappear and only fix is to discard changes.

    I was trying to log the file that causes the problem by putting Debuge.Log just before
    SerializedObject so = new SerializedObject(obj);
    but it prints out this:
    So I don't believe that's the issue.

    Any idea what is the root of evil? Or maybe some tip how to better debug this error?

    Thanks for your help.
     
  19. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Hey malyKuba,

    I believe what's happening here is that you have a variable probably named m_GameObject in your class somewhere. Unity has a bunch of hidden under-the-hood variables with names you're not allowed to conflict with. Typically their names follow that pattern: m_VariableName (you'll see them when you load a scene in a text editor). Can you double-check that you don't have a variable named that way in your class? When you catch that callstack, you can check what object you're serializing -- it may be hard to catch the callstack without a lot of step-throughs because it won't throw an exception that can be caught.

    Cheers.
     
  20. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    578
    Hi, I recently came upon the 4gb filesize limitation in unity and so have divided my scene into: terrain, static objects, lights, water etc.

    Now when I do a build only the first scene loads so will this asset solve that and load all scenes when I do a build and play mode.

    Of course its ok in the editor playmode but not in the build.

    Also, the merge scene function... does that create large files again or use separate files?

    Many thanks
     
  21. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    411
    Last edited: Dec 3, 2019
  22. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Hey Hawk0077,

    Are you building a 64-bit application? It sounds like you're running into the 32-bit memory limit. This asset does not address that memory limit because once all of your assets are loaded (and are above 4gb) you'll hit that 32-bit memory limit. Check your build settings to make sure you're using 64-bit mode (x64).

    Cheers.
     
    Hawk0077 likes this.
  23. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    578
    Thanks, but no, thats not the issue. Its unity scene filesize limit. But I split the scene up and that issue is solved.

    I actually have a scene loader now but your asset looks promising to use (if its possible) just to benefit from the Cross Scene Referencing.

    Can your asset be used just to take advantage of that feature?
    And play nice with another scene loader?

    Many thanks.
     
  24. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    419
    Yes, my asset does cross-scene referencing but in order to use it, you must have at least those two scenes loaded in the editor (the source scene and the destination scene). You can disable the other features of Advanced Multi-Scene by just setting the Scenes to "DontLoad" in the Editor, and thus using your own scene management to load them yourself.
     
    Hawk0077 likes this.
  25. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    578
    Thanks Jodon, much appreciated. I will get it in a while as I am just trying to fix something. Thanks again.