Hey guys.
I’ve got another unit test not working sadly with loading and unloading scenes. My code looks like:
string sceneName = "Assets/Scenes/TestScene/AddressableTestScene.unity";
SceneInstance loadedScene = new SceneInstance();
var loadingOperation = Addressables.LoadSceneAsync(sceneName, LoadSceneMode.Additive).Completed += scene =>
{
loadedScene = scene;
});
while (!loadingOperation.IsDone)
{
yield return null;
}
Assert.IsNotNull(loadedScene.Scene);
loadingOperation = Addressables.UnloadSceneAsync(loadedScene).Completed += unloadedScene =>
{
loadedScene = unloadedScene;
});
while (!loadingOperation.IsDone)
{
yield return null;
}
Assert.IsFalse(loadedScene.Scene.isLoaded);
The loading operation fills correctly the SceneInstance with all necessary information. As soon as I try to unload it, the SceneInstane information is completely lost and I can’t access name and/or path of that SceneInstance, although it is still loaded.
Can someone tell me what I am missing here?
Thanks,
Patrick