Search Unity

Failed to Decompress AssetBundle

Discussion in 'iOS and tvOS' started by iseta, Dec 2, 2019.

  1. iseta

    iseta

    Joined:
    May 5, 2016
    Posts:
    48
    Hello!
    I'm developing an app in Unity 2018.3.2f1, building for android was kinda painful, but we've managed and it's on Play Store currently.
    My biggest issue happens on iOS, where I get the following errors when running it on an Iphone 6S, connected to Xcode, etcetera. My bundles for iOS are being generated for the iOS platform already and are stored on firebase and get loaded through an URL, other links pointing to files (such as a .pdf for example) seem to work fine, so I'm assuming that the error lies on generating the bundles. Any help is honestly apreciated.

    Code (CSharp):
    1. 16:25:38.537595 -0300    SENAI-RA    Failed to decompress data for the AssetBundle 'rs_mecatronica'.
    2. UnityEngine.AssetBundle:LoadFromFile(String)
    3. AssetBundleManager:LoadFile()
    4. UnityEngine.Events.UnityEvent:Invoke()
    5. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    6. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
    7. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
    8. UnityEngine.EventSystems.StandaloneInputModule:Process()
    9. System.Threading.Interlocked:CompareExchange(T&, T, T)
    10. System.Threading.Interlocked:CompareExchange(T&, T, T)
    11. System.Threading.Interlocked:CompareExchange(T&, T, T)
    12.  
    13. [ line 445]
    14. (Filename:  Line: 445)
    15. padrão    16:25:38.548193 -0300    SENAI-RA    Failed to load AssetBundle!
    16. UnityEngine.Debug:LogErrorFormat(Object, String, Object[])
    17. UnityEngine.Logger:Log(LogType, Object)
    18. UnityEngine.Debug:Log(Object)
    19. UnityEngine.Events.UnityEvent:Invoke()
    20. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    21. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
    22. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
    23. UnityEngine.EventSystems.StandaloneInputModule:Process()
    24. System.Threading.Interlocked:CompareExchange(T&, T, T)
    25. System.Threading.Interlocked:CompareExchange(T&, T, T)
    26. System.Threading.Interlocked:CompareExchange(T&, T, T)
    27.  
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    I believe this error means a corrupted asset bundle file.
     
  3. iseta

    iseta

    Joined:
    May 5, 2016
    Posts:
    48
    As far as I've tested, it doesn't looks like it. Sorry. :(
    I have a lot of AssetBundles in my project, all of them are created under this script.

    Code (CSharp):
    1. using UnityEditor;
    2. using System.IO;
    3.  
    4. public class CreateAssetBundle
    5. {
    6.     [MenuItem("Assets/Build AssetBundles")]
    7.     static void BuildAllAssetBundles()
    8.     {
    9.         string assetBundleDirectory = "Assets/AssetBundles";
    10.         if (!Directory.Exists(assetBundleDirectory))
    11.         {
    12.             Directory.CreateDirectory(assetBundleDirectory);
    13.         }
    14.         BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None, BuildTarget.iOS);
    15.     }
    16. }
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    But does this error happen reliably regardless of where the bundle in question is placed, redownloaded etc.?
     
  5. iseta

    iseta

    Joined:
    May 5, 2016
    Posts:
    48
    The AssetBundle is currently being placed in the persistent data path, it works just fine on Android. Should I use another path on iOS? Thank you! Also, we're building separate bundles for Android and iOS.
     
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    But have you tried deleting that file and redownloading it?
     
  7. iseta

    iseta

    Joined:
    May 5, 2016
    Posts:
    48
    Oddly, that solved it.
    But somehow, when loading the AssetBundle on iOS, it crashes due to memory usage issues. The same AssetBundles load up just fine on Android, even if they do take a while to do that.
     
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    Well, that's what I meant with "corrupted file". The bundle was somehow damaged during transfer to device.

    That isn't necessarily a fair comparison. Do both platforms are 64-bit builds, for example?
    How much memory does it use on Android and how much on iOS at the moment of crash?
     
  9. iseta

    iseta

    Joined:
    May 5, 2016
    Posts:
    48
    I ran a memory diagnostics on Android, it seems to be... quite a large amount of memory. Im running the APP on an iphone 5S, which has only 1GB of RAM... makes sense that it would crash.



    Is there a way to make my assetbundles lighter memory-wise? Most of them dont even have 100MB in size.

    EDIT: I think this diagnosis could also help, my application is at the top

     
    Last edited: Dec 3, 2019
  10. iseta

    iseta

    Joined:
    May 5, 2016
    Posts:
    48
    For anyone having this issue on the future, I found no other fix than to limit my minimum iOS version to 11. Older phones just seem to have a hard time decompressing large AssetBundles. :(