This is the official Q&A thread for the AssetBundle Manager Tutorial.
AssetBundles allow on demand streaming and loading of Assets from a local or remote location. With AssetBundles, Assets can be stored remotely and accessed as needed, increasing the flexibility of the project and reducing the initial application size.
The AssetBundle Manager provides a High-level API for a massively improved workflow compared to manipulating AssetBundles directly with the foundation Low-level API.
Please be aware that this is a thread for answering specific questions and issues with the Tutorial, NOT a general AssetBundle support thread.
Please keep questions framed and related to the tutorial.
Please use the main support forums or answers for other AssetBundle related questions.
Questions will be moved or deleted from this section if they are not considered appropriate.
The tutorial can be found here.
The asset package can he found here.
There are other high level AssetBundle features we are working on. Donāt expect them to jump out and surprise you tomorrow, but there should be more to come.
Iāll update this thread and the tutorial and assets as needed.
How do I get the downloaded asset bundle manifest (or itās data) from AssetBundleManager.cs into another script?
At various places in AssetBundleManager.cs, Iāve tried to get the all the asset bundle names from m_AssetBundleManifest and save them to a string[ ], but to no avail. A null reference exception occurs.
Iām using LoadAssets.cs, but instead of setting each asset bundle name and asset name the inspector, I would like to use GetAssetBundleNames() to iterate through the manifest and instantiate assets according to certain conditions.
The new tutorial has been a great help, thank you for that. Relief was brought to my brain.
I finally managed to get the asset bundle manifest. In LoadAssets.cs, I used to following code in the Initialize() function to get the manifest from the variable: request:
Ah fantastic. Glad you got it working. There are many people tied up getting ready for, and this week attending, Unite 15 in Boston. Sorry for they delay.
Hi All!
I am beginner developer on Unity. What stores you can recommend me to put my different scenes bundles?
For example: I have 6 different game levels, I put it to 6 bundles. Can I use amazon S3 or google cloud platform to place my bundles? What will be easier and faster? Also I want to have CDN access. So users from all the word will have theirs native servers for my assets.
There are many options for that @Nickolay_I . from Azure, AWS and GameSparks.
Most offer some level of CDN support, although it does cost more obviously.
Just shop around for the best deal that fits you, just needs to be network accessible storage from the internet.
I went with Amazon S3 to store my asset bundles. Amazon Cloudfront is what Iām using to distribute the content. Cloudfront will take the files from S3 and copy them to servers located throughout the world.
I just signed up for Amazon Web Services and received 12 months access to those services for freeāup until a certain data allowance, afterwhich you pay for the excess data you use.
ok, how about also explaining exactly what is in the āAssetBundleServer.exeā Iām just starting to look over this tutorial and curiousā¦ is this something that if I were to create a batchmode project to automate assetbundle generation, this would or may have some dependencies?
itās like a black boxā¦ hopefully not a Pandora type box
[edit]
ok, iām starting to put it together in my mind (ILSpy, thanks )
and this:
ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(MonoInstallationFinder.GetMonoInstallation(āMonoBleedingEdgeā), ā4.0ā, pathToAssetServer, args, true);
interesting, Iāve not worked with asset bundles yet, but need toā¦ the tutorial is complex.
Iām trying to integrate Asset Bundles into my existing project, when I choose the āBuild Asset Bundlesā option I end up getting the error: "
Building AssetBundle failed because hash collision was detected in the deterministic id generation.
Conflict happened between Asset āAssets/$root/AssetContent/Volume2/SpriteCollections/Props/V2Props_Collection@2x_1 Data/atlas0 material.matā and āAssets/$root/AssetContent/Volume2/SpriteCollections/Story2/V2S2_Collection@4x_4 Data/atlas0 material.matā.
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
AssetBundles.BuildScript:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/BuildScript.cs:24)
AssetBundles.AssetBundlesMenuItems:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/AssetbundlesMenuItems.cs:27)
"
Could you help me understand what Iām doing wrong? Does some kind of similar naming of files cause hash collisions?
I am using 2D Toolkit which has sprite collections, and each of those has a material called āatlas material.matā, it seems like this is causing the issue? (Though they are in different folder
hierarchies
) Will I need to rename these somehow?
Iāve dealt with a ticket like this before, and let me share the information I recall:
The hash collision is not to do with the filename, itās to do with a field (visible in the YAML if you have text serialisation like this - 4: {fileID: 400030} ). The two filenames however can be used to narrow down the value search to those two files.
I think itās fixed in Unity 5.x.
I was able to fix it in the case I looked at by changing that 400030 to something else, in the case I looked at I used 490030. I changed every occurrence of 400030 in one of the YAML files to 490030 and the problem resolved itself, but I advised the customer to upgrade to 5.x to solve the issue āproperlyā.
Hello guys,
I have a question about clean the duplicated assets in asset bundles. for example
a.png is referenced by b.prefab and c.prefab
2.b.material is assigned to bundleb and c.material is asssigned to bundlec, a.png is not assigned.
now the a.png is duplicated in bundleb and bundlec. What I want to do is check the assets in all bundles and found the duplicated asset. but I canāt get the all asset in bundles. if I use GetAllAssetNames() or LoadAllAsset(), I only get b.prefab or a.prefab return.
How should I do?
I have found that lightmaps get stripped in some way. Thus including some baked lightmaps in the starting scene or a simple āblindā baked scene into the build prevents this. This works for me.
I am facing the same issue and my unity version is 5.2.2f1. The docs say that you calculate hash based on GUID and some other voodoo black magic but I donāt think this is a coincidence that whenever I have same names (different paths) of files I get this collision.
I just did the most simplistic project to test. I have an asset bundle with a variant on it and two different paths. (foo/bar and boo/baz) both contain a file i_hate_unity.txt with different contents.
GUIDS for those files stored in meta unity generated are different yet the collision occurs. Meta for txt files are so simple that there are no additional information like fileID or something else.
Therefore I assume that you take filename (not the path) into consideration while generating the hash thus the collision.
Correct me if I am wrong, but if this is true you would require us to have unique names on all files in the project which in large project that are already in production is almost impossible to fullfill.