Exception on Addressables.UnloadSceneAsync(AsyncOperationHandle)

Hi,

wanted to try Addressable Scene Loading and noticed an Exception on Scene Unloading. I have a scene with one object with a Script (simplified it for question):

using System;
using System.Collections;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.SceneManagement;

public class SceneLoader : MonoBehaviour {
    // scene from newly created group (Create New Group > Packed Assets)
    [SerializeField] AssetReference scene = default;

    [ContextMenu(nameof(Test))] // Run this in Play mode
    void Test() {
        StartCoroutine(LoadAndUnload());

        IEnumerator LoadAndUnload() {
            var operation = Addressables.LoadSceneAsync(scene, LoadSceneMode.Additive);
            yield return operation;
            yield return new WaitForSeconds(0.5f);
            Addressables.UnloadSceneAsync(operation);
        }
    }
}

On first Addressables.UnloadSceneAsync(AsyncOperationHandle) call an exception is thrown:


It fails because m_InternalOp.Version is 1 and m_Version 0.
Because of this Exception Addressables.UnloadSceneAsync(AsyncOperationHandle).Completed isn’t called.
Strangely it isn’t repeated on next Unload call. I also don’t see any other issues apart from this Exception. Scene is loading and unloading seemingly without any problems.
Might be related to this post .
Yeah, and I’m using Addressables v1.3.8 (and Unity v2019.3.0b8).

Update: Tested some more, Exception isn’t thrown for Addressables.UnloadSceneAsync(SceneInstance), but leftover UnloadSceneOp handle still stays in Addressables Event Viewer.

Hmm… this is strange. I’ve seen similar issues before but thought they were all resolved. Do you mind filing a bug with Unity and posting the case number here? I’ll have to look into this.

Filed a bug: Case 1197333.

Problem is in IssueTracker, somebody already reported it. I added a vote :wink: