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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Resolved Unloading the scene that is open when going into Play mode

Discussion in 'Addressables' started by banjolasse, Oct 4, 2021.

  1. banjolasse

    banjolasse

    Joined:
    Feb 13, 2016
    Posts:
    9
    Hi!
    I'm not finding any info on this, so it's likely I'm just missing something very obvious.

    I have a scene loader that uses additive Addressables.Load/UnloadAsync that stores the SceneInstance of the loaded scene and unloads it when loading another. Works great. However, when working in the editor and entering play mode, the scene open in the editor is obviously not loaded via my script and is therefore not cached for later unloading. So my question is, how do I unload it when moving into another scene? It remains open because I do additive loading.

    Any help appreciated!
     
  2. banjolasse

    banjolasse

    Joined:
    Feb 13, 2016
    Posts:
    9
    I found a solution, and as I expected it was dead simple. I was so focused on using the Addressables.UnloadAsync (which does not accept string key) that I forgot about trusty old SceneManager.

    upload_2021-10-8_17-35-13.png