void OnButtonClick() { if (string.IsNullOrEmpty(addressToAdd)) { Debug.LogError("Address To Add not set."); } else { if (m_ReadyToLoad) { Addressables.LoadScene(addressToAdd, LoadSceneMode.Additive).Completed += OnSceneLoaded; } else { Addressables.UnloadScene(m_LoadedScene).Completed += OnSceneUnloaded; } } }
/// <summary> /// Unloads a given scene from memory asynchronously. /// </summary> /// <param name="scene">Scene object to unload.</param> public async Task UnloadScene(SceneInstance scene) { Addressables.UnloadScene(scene); }