Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AssetBundleProvider creates extra UnityWebRequest

Discussion in 'Addressables' started by araki_yuta, Feb 6, 2020.

  1. araki_yuta

    araki_yuta

    Joined:
    Jan 21, 2020
    Posts:
    14
    I just ran into problem where I noticed AssetBundleProvider was creating extra UnityWebRequest even though I used DownloadDependencies in advance. I suppose it eventually falls back to loading from local cache as part of UnityWebRequest, but it was giving me web request failure error causing it to fail before falling back to local cache load. Has anyone experience similar issue? It looks like File.Exists(path) is never true.

    Code (CSharp):
    1. private void BeginOperation()
    2.         {
    3.             string path = m_ProvideHandle.ResourceManager.TransformInternalId(m_ProvideHandle.Location);
    4.             if (File.Exists(path))
    5.             {
    6.                 m_RequestOperation = AssetBundle.LoadFromFileAsync(path, m_Options == null ? 0 : m_Options.Crc);
    7.                 m_RequestOperation.completed += LocalRequestOperationCompleted;
    8.             }
    9.             else if (ResourceManagerConfig.ShouldPathUseWebRequest(path))
    10.             {
    11.                 var req = CreateWebRequest(m_ProvideHandle.Location);
    12.                 req.disposeDownloadHandlerOnDispose = false;
    13.                 m_WebRequestQueueOperation = WebRequestQueue.QueueRequest(req);
    14.                 if (m_WebRequestQueueOperation.IsDone)
    15.                 {
    16.                     m_RequestOperation = m_WebRequestQueueOperation.Result;
    17.                     m_RequestOperation.completed += WebRequestOperationCompleted;
    18.                 }

    Environment:
    Android 8
    Loading Data From aws s3
    Note: I do use little customized version of AssetBundleProvider but these code should be same...