Skip to content

The manager doesn't unload a scene #48

@VirtualMaestro

Description

@VirtualMaestro

Hey João,
I'm trying 3.2-Pre.1 version.
A scene is not unloaded. Here is an example:

private static readonly ILoadSceneInfo LoaderSceneInfo = new LoadSceneInfoName("Assets/Client/Scenes/Loader.unity");
private static readonly ILoadSceneInfo MainSceneInfo = new LoadSceneInfoName("Assets/Client/Scenes/Main.unity");

private ISceneManager _sceneManager;

void Start()
{
	_sceneManager = new AdvancedSceneManager(true);
}
... 2 seconds later
private void _OnConfigFileLoaded()
{
	_sceneManager.SceneLoaded += _OnSceneLoaded;
	_sceneManager.LoadSceneAsync(MainSceneInfo, true);
}

private void _OnSceneLoaded(Scene scene)
{
	_sceneManager.SceneUnloaded += _OnSceneUnloaded;
	_sceneManager.UnloadSceneAsync(LoaderSceneInfo);
}

private void _OnSceneUnloaded(Scene scene)
{
	Debug.LogWarning($"Scene unloaded: {scene.name}");
}

Here is a screenshot from the debugger to see that this scene is under the manager's control.

image

I hope this helps)
Thank you

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions