Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug? Handle of Addressables.CleanBundleCache() cannot be released

Discussion in 'Addressables' started by ggzerosum, Nov 26, 2021.

  1. ggzerosum

    ggzerosum

    Joined:
    Sep 26, 2017
    Posts:
    31
    'AsyncOperationHandle' which is return by 'Addressables.CleanBundleCache()' is always Valid but fail to be released.


    Source Code
    Code (CSharp):
    1.             await Addressables.InitializeAsync();
    2.  
    3.             AsyncOperationHandle<bool> handle = default;
    4.             try
    5.             {
    6.                 handle = Addressables.CleanBundleCache();
    7.                 while (!handle.IsDone && handle.OperationException == null)
    8.                 {
    9.                     await System.Threading.Tasks.Task.Yield();
    10.                 }
    11.  
    12.                 Debug.Log($"IsDone: {handle.IsDone}");
    13.                 Debug.Log($"Status: {handle.Status}");
    14.                 Debug.Log($"Has Exception?: {handle.OperationException != null}");
    15.                 Debug.Log($"Result: {handle.Result}");
    16.  
    17.                 Debug.Log($"Handle Is Valid?: {handle.IsValid()}");
    18.                 if (handle.IsValid())
    19.                 {
    20.                     Debug.Log($"Try release handle...");
    21.  
    22.                     Addressables.Release(handle);
    23.  
    24.                     Debug.Log($"Releasing handle Done...");
    25.                 }
    26.             }
    27.             catch (Exception e)
    28.             {
    29.                 Debug.LogException(e);
    30.             }
    Debug Messages
    upload_2021-11-26_15-56-46.png

    The IsValid function of AsyncOperationHandle does not guarantee that the Handle can be released. I don't know if this is the intended result, but if not, this is a serious bug.
     
  2. BIG_BROTHERs

    BIG_BROTHERs

    Joined:
    Jan 20, 2021
    Posts:
    2
    same question