Search Unity

EditorSceneManager.LoadSceneAsyncInPlayMode that AAS is using returns an empty scene

Discussion in 'Addressables' started by 5argon, May 11, 2019.

  1. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    I was wondering why
    Addressables.LoadSceneAsync
    returns an empty scene be it Single, Additive, allow or not allow activation.

    There is a code path that goes to
    EditorSceneManager.LoadSceneAsyncInPlayMode
    in editor instead of
    SceneManager.LoadSceneAsync
    which works, and I tried this code manually and it also loads an empty scene. (It loads but has no game object) Are there any requirements I overlooked to make it work? (Both via AAS or normally)

    Unity version 2019.1.1f
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    I seems to get it now. The first parameter of this method wants the path. But this method has flaws that if I put invalid path such as just the scene's name, it loads an empty scene of that name.

    Now getting back to AAS which seems to turn the key to path for this method. I think this is now AAS bug as my scene name was definitely also the key in the greyed out section. But when I dragged the scene out to below, which still use the same "Title" name as when greyed out, it works. So any chance that Built In Data > EditorSceneList is not working in editor?

    Screenshot 2019-05-11 18.40.03.png
     
  3. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    Not sure if same question, but I am also wondering about this.

    Can Addressables load anything in the Built In Data?
    And is there anything special about the "Default Local Group (Default)" group compared to any other group I create?
     
  4. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    I heard it could load things from Resources (async) by using the same key as Resources.Load (which is essentially the path relative to Resources) so I assume it should be able to load things in Built In Data.

    If you check the Addressable box on the asset inspector it will go to the default group.
     
  5. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Sounds like a bug, we'll look into it.

    some clarifications though would be helpful:
    - what play mode are you in? does this happen all the time, or only in certain modes or in Editor but not Player.
    - what exactly is the code you're calling when this happens?
     
  6. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Ok, you could try this with the Scene Loading of AAS sample from pinned thread.

    After opening the project in 2019.1.2f, the button could work because there is a key "FirstScene" assigned to the scene Foundation in AAS panel, then the code also use the string "FirstScene", so it could translate to the path to Foundation scene.

    Screenshot 2019-05-14 02.10.57.png
    To demonstrate that the grayed out name doesn't get the same treatment, remove that entry, rename the Foundation scene to FirstScene, and then add it to build settings. It should appear in the greyed out area with a name "FirstScene"

    Screenshot 2019-05-14 02.12.01.png

    Then if you try pressing the button again, it would still load FirstScene but the content is empty. (The button remains just because there is no camera to clear the screen)

    Screenshot 2019-05-14 02.12.17.png
     
    unity_bill likes this.
  7. Eggone_igg

    Eggone_igg

    Joined:
    Oct 9, 2018
    Posts:
    6
    I'm having the same problem, only within FAST_MODE, VIRTUAL_MODE is fine
     
  8. Eggone_igg

    Eggone_igg

    Joined:
    Oct 9, 2018
    Posts:
    6
    upload_2019-7-25_14-58-15.png
    Could it be tied to this?
     
  9. Eggone_igg

    Eggone_igg

    Joined:
    Oct 9, 2018
    Posts:
    6
    I realized that that the LoadSceneAsyncInPlay Mode requires Application.dataPath, if not it will not load succesfully, hence the black screen.

    So in SceneProvider.cs
    upload_2019-7-25_15-6-43.png
    This won't work, hence the black screen

    We are using 2018.3.8f1
     
    Last edited: Jul 25, 2019
  10. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    What black screen are you getting?

    If we follow the steps laid out by @5argon then we could repro the bug. That is fixed as of 1.1.5. When we try with current addressables, doing the steps described, it works now.

    So what are you doing to get a black screen on scene load? Please describe your steps/situation, or file a unity bug.
     
  11. Eggone_igg

    Eggone_igg

    Joined:
    Oct 9, 2018
    Posts:
    6
    The scene would appear in the hierachy, but nothing in the scene
     
  12. Eggone_igg

    Eggone_igg

    Joined:
    Oct 9, 2018
    Posts:
    6
    I fixed it by manually using the LoadAsyncInPlayMode and appending the Application.dataPath, during fast mode in the editor, to prevent any blocking of our currently development.
     
  13. Eggone_igg

    Eggone_igg

    Joined:
    Oct 9, 2018
    Posts:
    6
    Used 1.1.7 still has the same issue,
    var asyncLoad = Addressables.LoadSceneAsync(sceneName,UnityEngine.SceneManagement.LoadSceneMode.Additive);

    I still think it's tied to the InternalLoad
    upload_2019-8-7_18-42-23.png