Search Unity

Resources vs. StreamingAssets vs. Asset Bundles

Discussion in 'Scripting' started by ananta-das, Mar 27, 2015.

  1. ananta-das

    ananta-das

    Joined:
    Jan 9, 2015
    Posts:
    25
    Hello,

    I have a question regarding dynamic content for a scene. In my project, I sometimes need to introduce content into the scene that is not part of it when the build is processed. Imagine placing a house asset into the scene, without previously knowing what house the player will want to place.

    After digging through the docs, I can see there are basically three options (in the thread title) but I am not sure which one is the correct one to use. My constraints are the following:
    • I can imagine the dynamic content being quite large part of the game (possibly larger in size than the built scenes - in terms of byte size)
    • I would like to be able to provide additional dynamic content after the game is already deployed to the player, if possible. However, I could go with a patching solution outside of the game as well.
    The second point clearly points towards asset bundles, but from reading about them, it seems to me that you need to download the bundle from the internet each time you need to use it. What I would like to have is maybe an initial download when new content is introduces (think online game launchers) but then it is stored on your hard drive ready to be used. Is there a way to do this with asset bundles or do I need to use one of the others? And if so, which one would be the best for my scenario?

    Thanks in advance for any replies!

    Cheers
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    It sounds like AssetBundles are the best match for your needs.

    You can cache downloaded AssetBundles locally. (See Downloading AssetBundles)

    You can also store them outside of Unity's cache management and use "file://" for the WWW() URL.
     
  3. ananta-das

    ananta-das

    Joined:
    Jan 9, 2015
    Posts:
    25
    Great, thanks for the info, just what I was looking for!