Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Heino · Nov 25, 2015 at 03:15 PM · wwwassetbundles

Automatically update AssetBundles

Maybe there's something fundamental I've misunderstood about AssetBundles, but am I correct in assuming that AssetBundles is something that you should be able to change and update after release of your game, without having to change game code? If so, I don't understand the WWW class' LoadFromCacheOrDownload. This one takes a version number as input and only if this version number has changed or no cached version of the object exists does it download the package.

However this means that if we need to get a new version of an AssetBundle downloaded, we'd have to change the version number in LoadFromCacheOrDownload in our game code, which kind of defeats the purpose. What we want is to be able to change content of an AssetBundle to i.e. include new textures or new settings for objects, without having to create an update for our app, which the users would then have to download from the app store.

Basically the functionality we're after should download the AssetBundle if no cached version exists or the AssetBundle has changed on the server, independent on what version number is passed to LoadFromCacheOrDownload. How would I go about implementing such a feature? We don't want to re-download the entire package every time, since it could potentially be rather large.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by NoseKills · Nov 25, 2015 at 06:14 PM

So as you said, the version numbering only works for forcing different client builds to look for bundles cached with different version numbers. If your game is using a server, you could hook up this version number to a value you can change on the server and force updates that way, but that's perhaps not the best way to do it, but i think something like this is the only choice you have if you are using Unity 4.x.

The problem with what you want is: if the only information the client has are the bundles themselves, it would have to download them to know if they have changed or not, which defeats the whole purpose of caching.

The new bundle system in Unity 5 has a solution for this though. LoadFromCacheOrDownload in Unity 5 has a new overload that takes in a Hash128 instead of a version. When you build the bundles, a tiny "manifest bundle" is created and it in turn contains the hashes of all the actual bundles that you built.

The hash works exactly like the version number in the sense that if you download a bundle with a certain hash, if a previous download is found with the same hash the bundle will be fetched from cache, else it will be downloaded. But the important thing here is that you never cache the manifest bundle, so when you upload a new set of bundles with a new manifest bundle, the client can read the changed hashes from the manifest bundle and if you use them for LoadFromCacheOrDownload, all changed (and only the changed) asset bundles will be re-downloaded.

I strongly encourage everyone to watch this video ant the code examples related to it. The stuff I'm talking about happens starting at about 30 mins in.

You could do the same thing Unity 4 / version number by for example making a small text file with the version numbers for each bundle in it and making the client load that first in order to know what version to use for the LoadFromCacheOrDownload calls. The system is just a bit more robust in Unity 5 and it automatically handles unchanged/changed bundles.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Heino · Nov 25, 2015 at 07:43 PM 0
Share

Thank you, @Nose$$anonymous$$ills. That was exactly what I was looking for!

avatar image tomekkie2 · Nov 30, 2016 at 07:13 AM 0
Share

Hello, @Nose$$anonymous$$ills, how can you manage to use Hash128 in place of the version when the version type is supposed to be int? I am considering to use crc after extracting that from manifest text file and casting to int.

avatar image
0

Answer by technobayo · Apr 28, 2018 at 07:51 AM

I am interested in an update to this question in light of developments in AssetBundles. @Heino 's question is the same as my current dilema. Could you please help me with updated links or best approach to this issue @NoseKills . Thanks

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

39 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WWW class Windows Store 0 Answers

audio.play does not work 1 Answer

When to use IEnumerator ? 1 Answer

Scene Asset bundle 0 Answers

Video plays from Assetbundle in Cache Folder only on second play 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges