Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question How to Retrive Streaming Scene Bundle With Correct Name

Discussion in 'Addressables' started by okan_unity116, Feb 13, 2023.

  1. okan_unity116

    okan_unity116

    Joined:
    Oct 6, 2020
    Posts:
    4
    We moved some scene bundles from Default Local Group to Remote. Names are same as file name when they loaded from local group but the ones downloaded from the remote have meaningless names such as 0, 1, a, b. We have systems rely on scene names. So it is important for us that the runtime scene name and the file name are the same.

    Renaming after load also doesn't work and throws exception.

    Code (CSharp):
    1.  
    2. var sceneInstanceLocal =
    3.     await Addressables.LoadSceneAsync("SceneInDefaultGroupLabel", LoadSceneMode.Additive, false).Task;
    4. Debug.Log(sceneInstanceLocal.Scene.name); //Same as asset name
    5.        
    6. var sceneInstanceRemote =
    7.     await Addressables.LoadSceneAsync("SceneInRemoteLabel", LoadSceneMode.Additive, false).Task;
    8. Debug.Log(sceneInstanceRemote.Scene.name); //Random single char (0,1,a,e)
    9.        
    10. //This line throws InvalidOperationException: Setting a name on a saved scene is not allowed (the filename is used as name).
    11. //(Exception is not editor only and same on device)
    12. var scene = sceneInstanceRemote.Scene;
    13. scene.name = "CorrectName";
    14.  
    15.  
     
  2. okan_unity116

    okan_unity116

    Joined:
    Oct 6, 2020
    Posts:
    4