Search Unity

Question UnityWebRequestAsyncOperation: Success but no data

Discussion in 'Asset Bundles' started by Guillaume-atVolumiq, Sep 15, 2022.

  1. Guillaume-atVolumiq

    Guillaume-atVolumiq

    Joined:
    Sep 14, 2018
    Posts:
    36
    I'm trying to load an assetbundle from an url using UnityWebRequestAsyncOperation.
    After checking for the isDone I get a result = Success with downloadedBytes = 0 and responseCode = 0.
    Same code and url works fine for my coworker, it works fine for me on another bundles that uses the same ScriptableObject class and the same asset, built on another target device loads fine, it just won't when I try on Standalone/Windows.
    Any idea ?
     

    Attached Files:

  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    How does the code that loads it looks like?
     
  3. Guillaume-atVolumiq

    Guillaume-atVolumiq

    Joined:
    Sep 14, 2018
    Posts:
    36
    Did some tests, turns out it does download something, at least I get data from bundle.GetAllAssetNames(), so I guess my error is somewhere else.
    Still weird that the UnityWebRequest says 0 bytes downloaded and doesn't show a correct responseCode while saying the GET was a "success"
     

    Attached Files:

  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    You still haven't shown the code.
    The only thing I can guess without it is that you use asset bundle caching, so it loads bundle from cache instead of downloading.
     
  5. Guillaume-atVolumiq

    Guillaume-atVolumiq

    Joined:
    Sep 14, 2018
    Posts:
    36
    Here is our code.
    I tried to hunt down any kind of cache but hasn't find any.
     

    Attached Files:

    • code.png
      code.png
      File size:
      175.1 KB
      Views:
      131
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    You do, you pass hash argument to GetAssetBundle, which enables Unity built-in caching system. So that explains it - the bundle is found and loaded from the cache, so no download happened.