- Home /
Asset Bundle mismatch keeps returning.
I had an error saying that my Asset Bundles on the server were incompatible with my build so I re-built my asset bundle and re-uploaded it to the server. EVerything worked fine.
3 days later, I try to run the game again and I get the old error. My server bundles have NOT changed but my code has...but why should this affect anything?
I haver actually been finding this happening for several weeks, I keep updating the bundles and then some time later they are incompatible again.
What's going on?
AssetBundle loading failed because the NewMainMenuManager script serialization hash does not match. Supported: 5980f0fb, loading: 516fd6b7
The asset bundle 'https://d29ffhmmzc7021.cloudfront.net/DevelopmentBundles_Sept2013_U4/MainMenuScene.unity3d' could not be loaded because it references scripts that are not compatible with the currently loaded ones. Rebuild the AssetBundle to fix this error.
Answer by dorpeleg · Oct 15, 2013 at 08:23 AM
Your bundles are referencing to scripts in your project.
When you change the scripts in the project, the script that the bundle is referencing to no longer exists (it has the same name but its not the same script).
So you have to update the bundles each time you make a change to a script that is included in the bundles.
In more detail:
When you change your script, it's serialization value changes.
When the bundle is trying to access the script, its doing it by using the serialization value.
So as you can see from your error, the serialization value of the script is 5980f0fb but the bundle is trying to access 516fd6b7 (or it might be the other way around).
That makes sense, but this has never happened to me before despite having almost every scene in my project downloaded as an asset bundle (around 15 scenes). Only since U4 have I seen this. I have been using asset bundles in this same project for over 2 years!?
Also, the script in question only references scripts in the main build at runtime (ie in the Start() function) so how would it even know about the serialization until the attempt to reference it occurs?
The bundle knows the serialization of the scripts inside of it (the values are saved in the bundle during the building of the bundle).
And the values of the script that is in the project is saved somewhere in the project I guess.
Run-time or not, it doesn't matter.
The serialization happens as soon as unity recompile the scripts (after hitting save on the script).
It is possible they added this check only in U4.
Cool thanks. Do you think this is something new that's been introduced with U4? I don't understand why I have never had the problem before.
It looks like now, whenever I change any code I'll need to re-build and re-upload all my asset bundles, which was never the case previously.
-Oh..I just read ALL of your last comment. Thanks for this! I wonder if there is a way of bypassing the check...as my scenes never had any issues loading before..
I don't think so.
This check is used to make sure the bundle scripts are the same as the project scripts.
So you wont have any kind of problems like:
Adding a function to the project script then trying to call it on a bundle with an old script that doesn't have that function.
Hey, this is nuts.:)
Every time I change ANY code, I now have to wait 20 $$anonymous$$utes to rebuild all my asset bundles to be able to test the game. This really can't be right. It will take me an eternity to finish this way. I noticed that even when I make a small change in one file ALL my asset bundles get the mismatch error even though I can't see ANY references to the main build within the bundles themselves. What counts as a reference (A script call ie GetComponent or something else?)
Answer by kpdisney · Dec 17, 2013 at 07:38 PM
Hope this point helps: http://docs.unity3d.com/Documentation/Manual/DownloadingAssetBundles.html
Loading AssetBundles in the Editor When working in the Editor requiring AssetBundles to be built and loaded can slow down the development process. For instance, if an Asset from an AssetBundle is modified this will then require the AssetBundle to be rebuilt and in a production environment it is most likely that all AssetBundles are built together and therefore making the process of updating a single AssetBundle a lengthy operation. A better approach is to have a separate code path in the Editor that will load the Asset directly instead of loading it from an AssetBundle. To do this it is possible to use Resources.LoadAssetAtPath (Editor only).