Some small issues of Addressables 1.20

In the process of integrating Addressables, I found some small issues. I think reporting each of them with a bug report is too wasteful, so I posted here. If dev team needs a bug report for a specific issue, I can submit it.

  1. The ‘Dispose’ method is not called for ‘webReq’ in RequestOperation_completed of TextDataProvider.InternalOp

  2. SceneOp.Update is called twice each frame during scene loading

class SceneOp
{
    protected override void Execute()
    {
        // ...
       
        if (!m_DepOp.IsValid() || m_DepOp.OperationException == null)
        {
            m_Inst = InternalLoadScene(m_Location, loadingFromBundle, m_LoadSceneParameters, m_ActivateOnLoad, m_Priority);
            ((IUpdateReceiver)this).Update(0.0f);
            if (!IsDone)
                m_ResourceManager.AddUpdateReceiver(this);     <------
        }
       
        // ...
    }
}

class AsyncOperationBase<TObject>
{
    internal void InvokeExecute()
    {
        Execute();
        HasExecuted = true;
        IUpdateReceiver upOp = this as IUpdateReceiver;
        if (upOp != null)
            m_UpdateCallbacks.Add(m_UpdateCallback);      <------
    }
}
  1. SceneOp.Update may be called after scene is loaded and never be removed
  • If SceneOp completes in SceneOp.Execute, it will still be added to m_UpdateCallbacks in AsyncOperationBase.InvokeExecute
  1. In CleanBundleCacheOperation.Execute, when cache is not ready, it should return immediately
protected override void Execute()
{
    // ...

    if (!Caching.ready)
        CompleteInternal(false, false, "Cache is not ready to be accessed.");    <------

    // ...
}
  1. In DisableAssetImportOnBuild sample, the calling order of AssetDatabase.StopAssetEditing and AssetDatabase.StartAssetEditing should be reversed.
  1. In SerializationUtilities.WriteObjectToByteList, there are two code blocks to process typeof(int):
if (objectType == typeof(Int32))
{
    byte[] tmp = BitConverter.GetBytes((Int32)obj);
    buffer.Add((byte)ObjectType.Int32);
    buffer.AddRange(tmp);
    return tmp.Length + 1;
}

if (objectType == typeof(int))
{
    byte[] tmp = BitConverter.GetBytes((UInt32)obj);
    buffer.Add((byte)ObjectType.UInt32);
    buffer.AddRange(tmp);
    return tmp.Length + 1;
}

Hi @Alan-Liu thanks for the reporting these issues!

I’ll create some tickets for these, but next time please submit a bug report for each case. It’s easy for the team to miss a few threads posted here.

1 Like