Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Bug] Exception on Addressables.UnloadSceneAsync(AsyncOperationHandle)

Discussion in 'Addressables' started by RunninglVlan, Nov 8, 2019 at 12:03 PM.

  1. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    13
    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):
    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using UnityEngine;
    4. using UnityEngine.AddressableAssets;
    5. using UnityEngine.SceneManagement;
    6.  
    7. public class SceneLoader : MonoBehaviour {
    8.     // scene from newly created group (Create New Group > Packed Assets)
    9.     [SerializeField] AssetReference scene = default;
    10.  
    11.     [ContextMenu(nameof(Test))] // Run this in Play mode
    12.     void Test() {
    13.         StartCoroutine(LoadAndUnload());
    14.  
    15.         IEnumerator LoadAndUnload() {
    16.             var operation = Addressables.LoadSceneAsync(scene, LoadSceneMode.Additive);
    17.             yield return operation;
    18.             yield return new WaitForSeconds(0.5f);
    19.             Addressables.UnloadSceneAsync(operation);
    20.         }
    21.     }
    22. }
    23.  
    On first Addressables.UnloadSceneAsync(AsyncOperationHandle) call an exception is thrown:
    upload_2019-11-8_13-52-42.png
    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.
     
    Last edited: Nov 8, 2019 at 12:35 PM
  2. DavidUnity3d

    DavidUnity3d

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    81
    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.
     
    RunninglVlan likes this.
  3. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    13
    Filed a bug: Case 1197333.
     
    DavidUnity3d likes this.
  4. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    13
    Problem is in IssueTracker, somebody already reported it. I added a vote ;)
     
    Last edited: Nov 13, 2019 at 1:45 PM