Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Loading data at runtime (Asset Bundles)

Discussion in 'Game Design' started by fatality674, Feb 3, 2017.

  1. fatality674

    fatality674

    Joined:
    Nov 1, 2012
    Posts:
    24
    If I have an asset bundle stored locally on disk, Is there a way to load an individual asset from it rather than having to load the entire asset bundle first?

    For example, say I have 15 prefabs stored inside an asset bundle which totals around 150mb, is there a way to cherry pick what is loaded into memory? Or am I forced to diversify the bundle into smaller files to avoid issues?

    I'm finding that running the loadfromfile causes the application to block for around 20 seconds (Loading synchronously is required).
     
  2. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    Actually this is really the primary use case of asset bundles. The only thing loaded is the manifest necessary to know how to index the bundle resources. You can then pull out resources individually. I use fairly massive asset bundles and there is never any significant delay. I load all my prefabs and sounds synchronously on-demand from asset bundles as the game runs and my resource manager requests them. Eventually I will implement some sort of staling heuristic that will unload them to keep memory somewhat stable.

    This is also probably not the right forum for this question as this forum tends not to focus on technical issues.
     
    Kiwasi likes this.