Search Unity

How many assetBundles can be loaded at a time on iOS?

Discussion in 'Editor & General Support' started by Daylightsburning, May 28, 2014.

  1. Daylightsburning

    Daylightsburning

    Joined:
    Oct 24, 2013
    Posts:
    15
    Hi everyone,

    I have 350 asset bundles need to be loaded into scene (all with 'CreateFromFile'), total size on disk is about 9M, works fine on cheap Android test device and Mac, but failed on iPhone 4s, check found that only first 240 assets are loaded successfully and all after are failed, i tested it again on another iPhone 4s and it fails on 256th asset.

    At first i thought it might be a memory problem, then i changed my mind because all assets bundles are just 9M in total (Uncompressed).

    It just fails (CreateFromeFile returns null) and no warning or whatever, please some one help! thank you.


    Daylightsburning.
     
  2. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I think iOS only allows 255 files to be open at a time. Probably Unity is using 15 files, which leaves you 240. Just load the asset bundles in batches.
     
  3. Daylightsburning

    Daylightsburning

    Joined:
    Oct 24, 2013
    Posts:
    15
    Thanks for your reply, your reply confirmed the truth i found below :

    stackoverlow.com : Maximum amount of open files on iOS, in this thread they say its about 250. No matter what, it just proves iOS has max open file limit.

    I tried to use CreateFromMemory instead : load all assets in one coroutine but it takes too long (about 30seconds to load the whole scene VS. 1 second with CreateFromFile) , then i tried CreateFromMemory another way : create 350 coroutines to load them simultaneously, the time reduced to 7 seconds, but still unacceptable.

    In your reply :
    , can you kindly explain more how to do this? they are depended on each other with only one root prefab, i don't really think it's possible to load the root prefab unless i split the root prefab.

    Thank you.


    Daylightsburning.