Search Unity

Question Unload Scene without Scene Instance

Discussion in 'Addressables' started by alchemist_wurzelpurzel, Oct 18, 2022.

  1. alchemist_wurzelpurzel

    alchemist_wurzelpurzel

    Joined:
    Sep 4, 2018
    Posts:
    43
    Hi all,

    we have recently switched to Addressables Scene Loading and everything works fine. We have the very first scene of the game in our build settings and everything else is marked as Addressables. We load and unload scenes by AssetReference and SceneInstance respectively.

    However, in lots of situations during development, we don't enter play mode through our game start scene but rather in a testing environment scene that will then load all necessary stuff so we can immediately enter the game in any scene we want.
    Additionally, we can then still "teleport" into other testing environment scenes, unloading whatever was present before them. And here lies my issue.

    Addressables.UnloadSceneAsync() requires a SceneInstance that we don't have when just entering play mode in any testing scene. Is there an Addressables way of unloading that scene or do I have to resort back to the good old SceneManager.UnloadSceneAsync() to unload it via Scene struct?

    Thanks!
     
    AdamBebkoSL likes this.
  2. AdamBebkoSL

    AdamBebkoSL

    Joined:
    Dec 9, 2021
    Posts:
    33
    I'm running into a similar issue
     
  3. alchemist_wurzelpurzel

    alchemist_wurzelpurzel

    Joined:
    Sep 4, 2018
    Posts:
    43
    I ended up adjusting our scene management code to cache Scenes that were already open on Awake and to unload them via SceneManager.UnloadSceneAsync() when needed.