Release/unload scene handle when is loaded but not activated

Hi,

I’m loading a scene using:

m_level_status[p_load_level].m_handle = Addressables.LoadSceneAsync(l_level_name, LoadSceneMode.Additive, false);

When the scene is ready and want to move to that scene I fade to black my game and call

m_level_status[p_load_level].m_handle.Result.ActivateAsync();

That works fine, however sometimes I don’t want to move to that scene in the end, so I wait for it end loading (but I don’t activate it), and then I call:

  Addressables.UnloadSceneAsync(m_level_status[p_level_index].m_handle, UnloadSceneOptions.UnloadAllEmbeddedSceneObjects, true);

or

 Addressables.Release(m_level_status[p_level_index].m_handle);

Neither of them seem to free up what it was originally loaded. The editor still displays “is loading” next to the scene name and the memory profiler still shows assets from the level that I tried to unload.

Is not possible to release that, without calling ActivateAsync() first? I want to avoid callng that becase it causes a hiccup on my game, when I want to move to another level is fine because I can mask it in the level transition animation, but I cannot do that when unloading.

There is no way to cancel a scene load. And will not unload the scene, in fact Addressables keeps a reference and will not even attempt to unload, which fails if attempting to do so. After the scene has activated then it would immediately be unloaded in this case from the Addressables unload.

However the activation must be allowed to occur for the loading threads to progress or you will be stuck without being able to load anything else.

1 Like