Search Unity

AssetReference.ReleaseAsset() bug

Discussion in 'Addressables' started by Wawro01, Dec 11, 2019.

  1. Wawro01

    Wawro01

    Joined:
    Apr 23, 2014
    Posts:
    44
    Hey,

    is there any reason why to throw away current async operation handle? Reference counting breaks in that case and you are not to able to call LoadAssetAsync from multiple places and have reference count larger than 1 since asset bundle will not get released afterwards. I am using 1.2.4 version of addressables

    Code (CSharp):
    1.        
    2. //AssetReference.cs
    3. public virtual void ReleaseAsset()
    4.         {
    5.             if (!m_Operation.IsValid())
    6.             {
    7.                 Debug.LogWarning("Cannot release a null or unloaded asset.");
    8.                 return;
    9.             }
    10.             Addressables.Release(m_Operation);
    11.             //Why to do this?
    12.             m_Operation = default(AsyncOperationHandle);
    13.         }