Search Unity

UnityWebRequestAssetBundle.GetAssetBundle not working on iOS

Discussion in 'Asset Bundles' started by Deadshot1994, Apr 30, 2020.

  1. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    I am trying to download an AssetBundle I created for iOS and load it from a server.

    Code (CSharp):
    1.  void LoadAssetFromBundle()
    2.     {
    3.         StartCoroutine(GetAssetBundle());
    4.     }
    5.  
    6.     IEnumerator GetAssetBundle()
    7.     {
    8.         UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle("https://brain.rs/rkd/2/assetbundletestios");
    9.         yield return www.SendWebRequest();
    10.  
    11.         if (www.isNetworkError || www.isHttpError)
    12.         {
    13.             Debug.Log(www.error);
    14.         }
    15.         else
    16.         {
    17.             AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
    18.             myLoadedAssetBundle = bundle;
    19.             if (myLoadedAssetBundle != null)
    20.             {
    21.                 Debug.Log("It's downloaded");
    22.             }
    23.         }
    24.     }
    But it doesn't Debug and whenever I try to instantiate a prefab through this code it says that the Object reference is not set to an instance of an object.

    If anyone can help me with this, I'd be extremely grateful!
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Does it return a null bundle? That would mean the asset bundle was successfully downloaded, but Unity failed to load it. Try looking into log output, maybe that prints some more information. For debugging reasons you can also try putting the same bundle into StreamingAssets and then load it via AssetBundle.LoadFromFile, thouth it will probably still fail.
    Recommendation:
    - one more time check that bundle was build for iOS platform
    - download the bundle manually on your computer and compare agains the original, see if file isn't corrupted
    - maybe you use something in your bundle that the rest of your app doesn't use, so it gets stripped?
     
  3. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    Hi,

    I've tried putting the same bundle in StreamingAssets and it does load when using AssetBundle.LoadFromFile,

    It doesn't return any errors when I try to download from the web, but when I try to use AssetBundle.LoadAsset<GameObject>("Name"); it says that the reference is not set to an instance of an object.

    I've kept the same bundle in both StreamingAssets and the Server, but it doesn't work only when I try to download it form the server.

    EDIT:
    I've also downloaded and imported the assetBundle into the Unity Project and tried LoadFromFile and it works, so it's not assetBundle that's causing the issue
     
    Last edited: May 4, 2020
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Wait, that puzzles me. Have you done this in Editor? If so, then your bundle is built for Editor, so is incompatible with iOS.
     
  5. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    Hi yes, it loads in Editor on Mac and it loads on my iPad when I test it,

    I've used this code to build my AssetBundle


    Code (CSharp):
    1.  BuildPipeline.BuildAssetBundles(assetBundleDirectory,BuildAssetBundleOptions.None,BuildTarget.iOS
     
    Last edited: May 4, 2020
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    How do you load it when imported?
    The build line does look correct.
    Have you looked into console in XCode when it fails?
     
  7. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    This is when I try to load using UnityWebRequestAssetBundle and I don't get nothing, no errors when checking Network/HttpError and it does not print "This is not empty";
    Code (CSharp):
    1.    IEnumerator GetAssetBundle()
    2.     {
    3.         UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle("https://brain.rs/rkd/2/assetbundletestios");
    4.         yield return www.SendWebRequest();
    5.  
    6.         if (www.isNetworkError || www.isHttpError)
    7.         {
    8.             Debug.Log(www.error);
    9.         }
    10.         else
    11.         {
    12.             AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
    13.             myLoadedAssetBundle = bundle;
    14.             if (myLoadedAssetBundle != null)
    15.             {
    16.                 Debug.Log("this is not empty");
    17.             }
    18.         }
    19.     }
    This is standard load from file
    Code (CSharp):
    1. void LoadAssetFromBundleFile()
    2.     {
    3.         myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "assetbundletestios"));
    4.         if (myLoadedAssetBundle != null)
    5.         {
    6.             Debug.Log("Managed to load AssetBundle!");
    7.             return;
    8.         }
    9.     }
    The console in XCode just tells me that the Reference is not set to an Instance of an object.

    I usually can at least test it in editor using some Debug.Logs, it works on Android when I test this code from above for downloading and loading the AssetBundle I made for Android.
     
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    You should check whether the returned bundle is null and not try loading assets from it if it is.
    Are you using Development Player, that might print some additional info.
     
  9. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    Well this is where I am checking if it is null?

    AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
    myLoadedAssetBundle = bundle;
    if (myLoadedAssetBundle == null)
    {
    Debug.Log("this is empty");
    }


    Also I don't think I am using Development Player, I do not know how to turn it on.
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    You haven't showed this before. Yes, that's what you should be checking. Is it null when you experience failures?
     
  11. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25

    Hi,

    I made a Couroutine that after 10 seconds Debugs whether the bundle is null. It does say that the bundle is null.

    I know the file isn't corrupted, because when I download it and put the bundle inside StreamingAssets, it works just fine.

    Any solution?
     
    Last edited: May 4, 2020
  12. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Try UnityWebRequest.Get and then AssetBundle.LoadFromMemory. Or simply save to file and check.
    One possible issue is that the link might point to a website which triggers the download in browser, however, UnityWebRequest would get the website, not the bundle. You need to use the direct links that give actual files.
     
  13. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    Thank you for that solution, I will try it, but just for clearance, when I use UnityWebRequestAssetBundle.GetAssetBundle I put the direct link to the file.

    The UnityWebRequestAssetBundle.GetAssetBundle for Android has a similar link and works like a charm, I do not know why the iOS bundle doesn't get loaded properly.
     
  14. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Save it to file and compare against the original. There should be some difference.
     
  15. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    I've saved .manifest from the server and I opened the .manifest that I have in StreamingAssets. They are both identical.

    This one is the manifest which we have uploaded to a server:
    Code (CSharp):
    1. ManifestFileVersion: 0
    2. CRC: 1158685584
    3. Hashes:
    4.   AssetFileHash:
    5.     serializedVersion: 2
    6.     Hash: 5d543a48c7e58321e66d8e55b985d8fd
    7.   TypeTreeHash:
    8.     serializedVersion: 2
    9.     Hash: 6fbb8d6124289168ff82d3cf6ede1c2d
    10. HashAppended: 0
    11. ClassTypes:
    12. - Class: 1
    13.   Script: {instanceID: 0}
    14. - Class: 4
    15.   Script: {instanceID: 0}
    16. - Class: 20
    17.   Script: {instanceID: 0}
    18. - Class: 21
    19.   Script: {instanceID: 0}
    20. - Class: 23
    21.   Script: {instanceID: 0}
    22. - Class: 28
    23.   Script: {instanceID: 0}
    24. - Class: 33
    25.   Script: {instanceID: 0}
    26. - Class: 43
    27.   Script: {instanceID: 0}
    28. - Class: 48
    29.   Script: {instanceID: 0}
    30. - Class: 54
    31.   Script: {instanceID: 0}
    32. - Class: 64
    33.   Script: {instanceID: 0}
    34. - Class: 65
    35.   Script: {instanceID: 0}
    36. - Class: 74
    37.   Script: {instanceID: 0}
    38. - Class: 82
    39.   Script: {instanceID: 0}
    40. - Class: 83
    41.   Script: {instanceID: 0}
    42. - Class: 90
    43.   Script: {instanceID: 0}
    44. - Class: 91
    45.   Script: {instanceID: 0}
    46. - Class: 95
    47.   Script: {instanceID: 0}
    48. - Class: 102
    49.   Script: {instanceID: 0}
    50. - Class: 108
    51.   Script: {instanceID: 0}
    52. - Class: 114
    53.   Script: {fileID: 11500000, guid: 80ca8d20214f40846b9e49b318255592, type: 3}
    54. - Class: 114
    55.   Script: {fileID: 11500000, guid: 3bf6d970cd2b79547a98f2dbf434935f, type: 3}
    56. - Class: 114
    57.   Script: {fileID: 11500000, guid: d498f591124524d39bd1c677afb2f2cd, type: 3}
    58. - Class: 114
    59.   Script: {fileID: 11500000, guid: dc4f2f91673ed344bbefeab4a66ff936, type: 3}
    60. - Class: 114
    61.   Script: {fileID: 11500000, guid: 832e23b35be634012b9f9565a2b76a3c, type: 3}
    62. - Class: 114
    63.   Script: {fileID: 11500000, guid: 8c48a894d8f4e4d4f93b7eb9314c564a, type: 3}
    64. - Class: 114
    65.   Script: {fileID: 11500000, guid: e2fcf505b302dac45959bd67e47bd784, type: 3}
    66. - Class: 114
    67.   Script: {fileID: 11500000, guid: 576bc9d5dcda44019a10432b98e1e86b, type: 3}
    68. - Class: 114
    69.   Script: {fileID: 11500000, guid: 39e8c956cffbc4b4ba68531bef53e1d4, type: 3}
    70. - Class: 114
    71.   Script: {fileID: 11500000, guid: 5d1e25a6744454219b8cdf0cfac9a57b, type: 3}
    72. - Class: 114
    73.   Script: {fileID: 11500000, guid: d443fc0788fa24c0baae5cebc76c05c9, type: 3}
    74. - Class: 114
    75.   Script: {fileID: 11500000, guid: 99526b17e6cfe403faa6484f14438fd4, type: 3}
    76. - Class: 114
    77.   Script: {fileID: 11500000, guid: c810b6e889701bc4a88b8aad76a8bea9, type: 3}
    78. - Class: 114
    79.   Script: {fileID: 11500000, guid: 99e7508a0a12b4d3daed2c0cad62f487, type: 3}
    80. - Class: 114
    81.   Script: {fileID: 11500000, guid: 85212d1b13358614ca54e74ba56f93ef, type: 3}
    82. - Class: 114
    83.   Script: {fileID: 11500000, guid: f512ef1bb59814d2ba63730568e89511, type: 3}
    84. - Class: 114
    85.   Script: {fileID: 11500000, guid: 7306576cd86f4497985b5a1169423094, type: 3}
    86. - Class: 114
    87.   Script: {fileID: 11500000, guid: 676f911d75a514d0eb4023dc32a73b98, type: 3}
    88. - Class: 114
    89.   Script: {fileID: 11500000, guid: acdd962eebcfa2e46b666901259e730f, type: 3}
    90. - Class: 114
    91.   Script: {fileID: 11500000, guid: f8c674bf6f1ef4e5788367c5d62f9bcd, type: 3}
    92. - Class: 115
    93.   Script: {instanceID: 0}
    94. - Class: 128
    95.   Script: {instanceID: 0}
    96. - Class: 134
    97.   Script: {instanceID: 0}
    98. - Class: 135
    99.   Script: {instanceID: 0}
    100. - Class: 137
    101.   Script: {instanceID: 0}
    102. - Class: 183
    103.   Script: {instanceID: 0}
    104. - Class: 198
    105.   Script: {instanceID: 0}
    106. - Class: 199
    107.   Script: {instanceID: 0}
    108. - Class: 212
    109.   Script: {instanceID: 0}
    110. - Class: 213
    111.   Script: {instanceID: 0}
    112. - Class: 328
    113.   Script: {instanceID: 0}
    114. - Class: 329
    115.   Script: {instanceID: 0}
    116. Assets:
    117. - Assets/Resources/Prefabs/Prefab-EdVideo-12.prefab
    118. - Assets/Resources/Prefabs/Marangoni_inside_plastic_wave.prefab
    119. - Assets/Resources/Prefabs/prefab-turtles-wall.prefab
    120. - Assets/Resources/Prefabs/Prefab-Sardines.prefab
    121. - Assets/Resources/Prefabs/Prefab-Welcome.prefab
    122. - Assets/Resources/Prefabs/Prefab-Shark&Scuba.prefab
    123. - Assets/Resources/Prefabs/test.prefab
    124. - Assets/Resources/Prefabs/Turtle.prefab
    125. - Assets/Resources/Prefabs/Prefab-ILOVENY-1.prefab
    126. - Assets/Resources/Prefabs/Prefab-EdVideo-7.prefab
    127. - Assets/Resources/Prefabs/prefab-plasticanimals.prefab
    128. - Assets/Resources/Prefabs/prefab-orca-wall.prefab
    129. - Assets/Resources/Prefabs/Prefab-Vortex.prefab
    130. - Assets/Resources/Prefabs/Prefab-Jellyfish-Wall.prefab
    131. - Assets/Resources/Prefabs/Prefab-PlantATree.prefab
    132. - Assets/Resources/Prefabs/prefab-floatingplastic.prefab
    133. - Assets/Resources/Prefabs/template-fish.prefab
    134. - Assets/Resources/Prefabs/Manta Ray.prefab
    135. - Assets/Resources/Prefabs/1Hotel_ElectricCars.prefab
    136. - Assets/Resources/Prefabs/Prefab-EdVideo-1.prefab
    137. - Assets/Resources/Prefabs/Prefab-FallingPlastic.prefab
    138. - Assets/Resources/Prefabs/Prefab-EdVideo-tensel2.prefab
    139. - Assets/Resources/Prefabs/Prefab-EdVideo-tensel1.prefab
    140. - Assets/Resources/Prefabs/Prefab-Butterfly.prefab
    141. - Assets/Resources/Prefabs/butterfly.prefab
    142. - Assets/Resources/Prefabs/Prefab-PlasticAnimals 1.prefab
    143. - Assets/Resources/Prefabs/Prefab-EdVideo-2.prefab
    144. - Assets/Resources/Prefabs/Prefab-Bees.prefab
    145. - Assets/Resources/Prefabs/Stump_1Hotel_Bike.prefab
    146. - Assets/Resources/Prefabs/prefab-reindeer-floor.prefab
    147. - Assets/Resources/Prefabs/template-floating-plasticbag.prefab
    148. - Assets/Resources/Prefabs/Prefab-MicroplasticRainbow.prefab
    149. - Assets/Resources/Prefabs/Prefab-EdVideo-9.prefab
    150. Dependencies: []
    151.  
    This one is from StreamingAssets:

    Code (CSharp):
    1. ManifestFileVersion: 0
    2. CRC: 1158685584
    3. Hashes:
    4.   AssetFileHash:
    5.     serializedVersion: 2
    6.     Hash: 5d543a48c7e58321e66d8e55b985d8fd
    7.   TypeTreeHash:
    8.     serializedVersion: 2
    9.     Hash: 6fbb8d6124289168ff82d3cf6ede1c2d
    10. HashAppended: 0
    11. ClassTypes:
    12. - Class: 1
    13.   Script: {instanceID: 0}
    14. - Class: 4
    15.   Script: {instanceID: 0}
    16. - Class: 20
    17.   Script: {instanceID: 0}
    18. - Class: 21
    19.   Script: {instanceID: 0}
    20. - Class: 23
    21.   Script: {instanceID: 0}
    22. - Class: 28
    23.   Script: {instanceID: 0}
    24. - Class: 33
    25.   Script: {instanceID: 0}
    26. - Class: 43
    27.   Script: {instanceID: 0}
    28. - Class: 48
    29.   Script: {instanceID: 0}
    30. - Class: 54
    31.   Script: {instanceID: 0}
    32. - Class: 64
    33.   Script: {instanceID: 0}
    34. - Class: 65
    35.   Script: {instanceID: 0}
    36. - Class: 74
    37.   Script: {instanceID: 0}
    38. - Class: 82
    39.   Script: {instanceID: 0}
    40. - Class: 83
    41.   Script: {instanceID: 0}
    42. - Class: 90
    43.   Script: {instanceID: 0}
    44. - Class: 91
    45.   Script: {instanceID: 0}
    46. - Class: 95
    47.   Script: {instanceID: 0}
    48. - Class: 102
    49.   Script: {instanceID: 0}
    50. - Class: 108
    51.   Script: {instanceID: 0}
    52. - Class: 114
    53.   Script: {fileID: 11500000, guid: 80ca8d20214f40846b9e49b318255592, type: 3}
    54. - Class: 114
    55.   Script: {fileID: 11500000, guid: 3bf6d970cd2b79547a98f2dbf434935f, type: 3}
    56. - Class: 114
    57.   Script: {fileID: 11500000, guid: d498f591124524d39bd1c677afb2f2cd, type: 3}
    58. - Class: 114
    59.   Script: {fileID: 11500000, guid: dc4f2f91673ed344bbefeab4a66ff936, type: 3}
    60. - Class: 114
    61.   Script: {fileID: 11500000, guid: 832e23b35be634012b9f9565a2b76a3c, type: 3}
    62. - Class: 114
    63.   Script: {fileID: 11500000, guid: 8c48a894d8f4e4d4f93b7eb9314c564a, type: 3}
    64. - Class: 114
    65.   Script: {fileID: 11500000, guid: e2fcf505b302dac45959bd67e47bd784, type: 3}
    66. - Class: 114
    67.   Script: {fileID: 11500000, guid: 576bc9d5dcda44019a10432b98e1e86b, type: 3}
    68. - Class: 114
    69.   Script: {fileID: 11500000, guid: 39e8c956cffbc4b4ba68531bef53e1d4, type: 3}
    70. - Class: 114
    71.   Script: {fileID: 11500000, guid: 5d1e25a6744454219b8cdf0cfac9a57b, type: 3}
    72. - Class: 114
    73.   Script: {fileID: 11500000, guid: d443fc0788fa24c0baae5cebc76c05c9, type: 3}
    74. - Class: 114
    75.   Script: {fileID: 11500000, guid: 99526b17e6cfe403faa6484f14438fd4, type: 3}
    76. - Class: 114
    77.   Script: {fileID: 11500000, guid: c810b6e889701bc4a88b8aad76a8bea9, type: 3}
    78. - Class: 114
    79.   Script: {fileID: 11500000, guid: 99e7508a0a12b4d3daed2c0cad62f487, type: 3}
    80. - Class: 114
    81.   Script: {fileID: 11500000, guid: 85212d1b13358614ca54e74ba56f93ef, type: 3}
    82. - Class: 114
    83.   Script: {fileID: 11500000, guid: f512ef1bb59814d2ba63730568e89511, type: 3}
    84. - Class: 114
    85.   Script: {fileID: 11500000, guid: 7306576cd86f4497985b5a1169423094, type: 3}
    86. - Class: 114
    87.   Script: {fileID: 11500000, guid: 676f911d75a514d0eb4023dc32a73b98, type: 3}
    88. - Class: 114
    89.   Script: {fileID: 11500000, guid: acdd962eebcfa2e46b666901259e730f, type: 3}
    90. - Class: 114
    91.   Script: {fileID: 11500000, guid: f8c674bf6f1ef4e5788367c5d62f9bcd, type: 3}
    92. - Class: 115
    93.   Script: {instanceID: 0}
    94. - Class: 128
    95.   Script: {instanceID: 0}
    96. - Class: 134
    97.   Script: {instanceID: 0}
    98. - Class: 135
    99.   Script: {instanceID: 0}
    100. - Class: 137
    101.   Script: {instanceID: 0}
    102. - Class: 183
    103.   Script: {instanceID: 0}
    104. - Class: 198
    105.   Script: {instanceID: 0}
    106. - Class: 199
    107.   Script: {instanceID: 0}
    108. - Class: 212
    109.   Script: {instanceID: 0}
    110. - Class: 213
    111.   Script: {instanceID: 0}
    112. - Class: 328
    113.   Script: {instanceID: 0}
    114. - Class: 329
    115.   Script: {instanceID: 0}
    116. Assets:
    117. - Assets/Resources/Prefabs/Prefab-EdVideo-12.prefab
    118. - Assets/Resources/Prefabs/Marangoni_inside_plastic_wave.prefab
    119. - Assets/Resources/Prefabs/prefab-turtles-wall.prefab
    120. - Assets/Resources/Prefabs/Prefab-Sardines.prefab
    121. - Assets/Resources/Prefabs/Prefab-Welcome.prefab
    122. - Assets/Resources/Prefabs/Prefab-Shark&Scuba.prefab
    123. - Assets/Resources/Prefabs/test.prefab
    124. - Assets/Resources/Prefabs/Turtle.prefab
    125. - Assets/Resources/Prefabs/Prefab-ILOVENY-1.prefab
    126. - Assets/Resources/Prefabs/Prefab-EdVideo-7.prefab
    127. - Assets/Resources/Prefabs/prefab-plasticanimals.prefab
    128. - Assets/Resources/Prefabs/prefab-orca-wall.prefab
    129. - Assets/Resources/Prefabs/Prefab-Vortex.prefab
    130. - Assets/Resources/Prefabs/Prefab-Jellyfish-Wall.prefab
    131. - Assets/Resources/Prefabs/Prefab-PlantATree.prefab
    132. - Assets/Resources/Prefabs/prefab-floatingplastic.prefab
    133. - Assets/Resources/Prefabs/template-fish.prefab
    134. - Assets/Resources/Prefabs/Manta Ray.prefab
    135. - Assets/Resources/Prefabs/1Hotel_ElectricCars.prefab
    136. - Assets/Resources/Prefabs/Prefab-EdVideo-1.prefab
    137. - Assets/Resources/Prefabs/Prefab-FallingPlastic.prefab
    138. - Assets/Resources/Prefabs/Prefab-EdVideo-tensel2.prefab
    139. - Assets/Resources/Prefabs/Prefab-EdVideo-tensel1.prefab
    140. - Assets/Resources/Prefabs/Prefab-Butterfly.prefab
    141. - Assets/Resources/Prefabs/butterfly.prefab
    142. - Assets/Resources/Prefabs/Prefab-PlasticAnimals 1.prefab
    143. - Assets/Resources/Prefabs/Prefab-EdVideo-2.prefab
    144. - Assets/Resources/Prefabs/Prefab-Bees.prefab
    145. - Assets/Resources/Prefabs/Stump_1Hotel_Bike.prefab
    146. - Assets/Resources/Prefabs/prefab-reindeer-floor.prefab
    147. - Assets/Resources/Prefabs/template-floating-plasticbag.prefab
    148. - Assets/Resources/Prefabs/Prefab-MicroplasticRainbow.prefab
    149. - Assets/Resources/Prefabs/Prefab-EdVideo-9.prefab
    150. Dependencies: []

    Edit: I also tried using UnityWebRequest.Get and AssetBundle.LoadFromMemory
    Code (CSharp):
    1. var www = UnityWebRequest.Get("https://brain.rs/rkd/2/assetbundletestios");
    2.         yield return www.SendWebRequest();
    3.         byte[] decryptedBytes = MyDecription(www.downloadHandler.data);
    4.         myLoadedAssetBundle = AssetBundle.LoadFromMemory(decryptedBytes);
    But it still doesn't load the assetBundle, says it's null.

    If you want to test, this is the link https://brain.rs/rkd/assetbundletestios

    I've tried 15 different ways, nothing seems to show me why Unity doesn't load the bundle.
     
    Last edited: May 5, 2020
  16. Deadshot1994

    Deadshot1994

    Joined:
    Sep 6, 2015
    Posts:
    25
    Could it be that because the AssetBundle for IOS is almost 230MBs while the AssetBundle for Android is 40MBs? Maybe the .SendWebRequest takes too long to download it?


    Edit: So everything was working, but it's the size of the AssetBundle that's causing the issue? Can the IOS AssetBundle be lowered? How come it's almost 5x more than my bundle for Android?
     
    Last edited: May 5, 2020
  17. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Timing is not an issue, but you may be running out of disk space. And your bundle does indeed look too large, you should consider splitting it into multiple smaller ones.
     
  18. andrew_pearce

    andrew_pearce

    Joined:
    Aug 5, 2019
    Posts:
    9
    I faced the same issue but in my case remote bundle was working but local one - does not. Since this topic is in Google's search results, I will add the solution for next person who will face the same issue.

    For iOS you need manually add "file://" to the streamingAssetpath. Also, please note that Path.Combine() strips "file://" for some reason. So Path.Combine("file://", Application.streamingAssetsPath, uri) will give you the same result as Path.Combine(Application.streamingAssetsPath, uri). So the proper way to do it: "file://" + Path.Combine(Application.streamingAssetsPath, uri).