I have created some asset bundles from my Unity assets using the directions given in the Unity documentation section on AssetBundle Workflow. After running the "Build AssetBundles" command, each asset bundle results in four files: myasset, myasset.meta, myasset.manifest, myasset.manifest.meta.
Now I am ready to deploy these bundles to a web server and implement downloading/caching in my Unity project. I have found numerous examples such as this that show the download URL to be a single file with a .unity3d extension. This is leading me to conclude that I am missing a step - I assume that all four of my files will be required by the app and that I have to do something to combine them into a .unity3d file first.
Unity creates the .meta files for all assets- you don't have to worry about those. In short, your myasset file is enough. I do not add file extensions to mine. Do note that if you use the strategy shown in the example that you shared that the client will re-download the bundle from the server every time. You need to additionally provide a version number if you want to take advantage of caching. You can see this in some of the method overloads here, the ones that have a Hash128 or uint "version" parameter. Caching is great because you can use the bundle that is already saved on the device next time instead of downloading from the server when no changes have occurred. The version/hash number you provide essentially gets mapped to the file name. Whenever a matching version is found, the file on disk is used. Update the version number to something else when the content changes to force the client to download anew.
You may want to reference the .manifest file for the CRC value listed there. You may have noticed a crc parameter in the link I shared as well. This can be used to ensure data integrity during transmission of the bundle data. You can make sure the downloaded content's CRC matches that of the bundle when you created it.
If this is how you are supposed to do it, why does the main mainfest(example Android.manifest) which can be loaded into a class AssetBundleManifest, have a function to get the hashes for you: unity doc
I was able to just use that technique up until now, but I have hit a problem where it failed to detect a hash change properly and that function is not giving me back the same hash that I see in one of my other bundles .manifest file
Just an update to this in case a future traveler encounters issues of hashes not seeming to work right. After banging my head against this (as using the server stored hashes had the same problem) all day long, I finally found out what was going on. There was a stealth dupe of an asset being inserted into another bundle. The reason I thought my hashes were not correct is because despite the correct asset being in bundle A, there was the stealth copy of the image in bundle B that was the old version. Unity was choosing to use the one in B. This stealth asset does not appear in the manifest for bundle B and is not mentioned in the browser as a warning duplicate asset... Truly a mystery. Makes me wonder how much dupe garbage file size is being used up by other stealth assets...
I am developing a VR experience using Unreal 4.25 Blueprint. I want to download Some assets that reside on Cloud to replace existing ones in my build project. What i need to do to achieve that. I am a unity developer and Learning Unreal. As in unity through the Assets bundle, we achieve this, What is equivalent for this in Unreal?
I see that Unity provides addressables as new solution for asset management. As its new (not very new as its accessible from 2018.2, but official docs dont say a lot) there is not so much about it on the web.
From what it seems, in addressables you dont need to care about the bundle version, or which asset is in which bundle. In addresables, Unity automatically uploads assets to your host, and Unity automatically correctly manages local caching or downloads from a server, so objects behave like they are in the main game package but you have to check if they are loaded or downloaded. Am I right?Are there any other features that addressables offer?
This used to be pretty annoying with asset bundles. First you had to know in which asset bundles that asset was hiding in. Then you had to find out if this asset bundles was already loaded, and when it wasn't you had to load it first. And only then were you able to retrieve the asset with assetBundle.LoadAsset(name).
But with Addressables you just need to know the address string. You can then just do Addressables.LoadAsset(address); and Unity will automatically find out if the asset and its dependencies need to be loaded from the local filesystem or from a remote server and do so if necessary.
Personally I also don't get it. If you made the game and you saved your content intelligently then knowing where an asset is located is as easy as knowing the filepath to it (rather than a file url). Using the old WWW.LoadFromCacheOrDownload() meant getting ahold of the latest version and loading it was one line of code.
Now you first have to create online projects to generate buckets and keys for the project and buckets so you can then download a CLI to authorize your system before you can then go into Unity and create a URL based of an existing URL you just magically have to know and then augmented with 2 of the API keys you get from the online project under a few submenus deep before you can finally get around to building the asset bundles (hey look, back to where we started) and publish it to the development URL until you are ready to release in which case you build and publish to the release bucket and NOW... now it is so much easier to use because now you just have to know the address string which is sooooooo much easier than knowing the file path you placed your content into.
Hi there, I am trying to build a relatively simple DLC content system with PlayFab. I have a problem with the downloaded file, however, getting error "Error while downloading Asset Bundle: Failed to decompress data for the AssetBundle".
After debugging it looks like the logic is getting the URL correctly, the downloading itself is successful and in the request object, there is seemingly the correct amount of bytes received. The moment I get to the point of retrieving the assetBundle object I get the error above and the bundle itself is null.
Interestingly enough, if I use the URL provided by the PlayFab API in a browser, the file I download is successfully loaded via AssetBundle.LoadFromFileAsync test call. So, the binary format seems to be intact.
I have not messed with asset bundles in a while, nearly a year. I had created this little repository sample of using the Asset Bundle manager with our service. This was before UnityWebRequest and it has not been tested on anything remotely near 2017.x or 2018.x, however you might want to take a look at what I was doing with it, as it might give you some clue.
From my perspective, you seem to be doing all the right stuff in your code above. However, it looks like your taking the asset bundle and passing it to a callback "onAssetBundleRetrieved" .. I wasn't doing that. I went about loading the asset bundles a different way.
Another thing to note is the mime-type of the asset when you uploaded it to the CDN. If you do not specify that it is a application/binary, when it downloads from the CDN it might pass with the headers the wrong mime-type with delivery which could mess things up.
For now, things seem to function well enough if I am not attempting to use a custom cache path. Unfortunately, the documentation in Unity API is not complete on that particular topic, so I'll park it for the time being and return to it when I start polishing the game. If I find a solution for it, I'll post it here in case someone else hits that particular wall in the future. :)
I tried as you suggested and the files are identical. After that, I managed to make it work using the hash only instead of the CachedAssetBundle object. It looks like the issue is with that particular class in Unity's framework, but so far I haven't been able to identify what exactly fails there. So, essentially changing the web request to:
LinkedIn and 3rd parties use essential and non-essential cookies to provide, secure, analyze and improve our Services, and to show you relevant ads (including professional and job ads) on and off LinkedIn. Learn more in our Cookie Policy.
Addressable and asset bundles are both techniques used in game development to manage and optimize the loading and storage of game assets, but they have different approaches and use cases. Let's explore each of them:
Addressable is a system introduced by Unity Technologies to provide a more flexible and efficient way to manage and load game assets. It allows developers to decouple asset references from their physical locations, making it easier to load and update assets dynamically during runtime.
Asset Bundles are a feature in Unity that allows developers to package game assets (such as textures, models, audio files, etc.) together into separate files for efficient loading and storage. Asset Bundles are created during the development process and are typically loaded at runtime.
Deployment and Updates: Bundles can be deployed and updated separately from the main game package, allowing developers to deliver new assets or updates without requiring players to download the entire game.
Comparison: Addressable focus on the management and loading of assets, providing features like dynamic loading, versioning, and remote hosting. It offers a more flexible and granular approach for asset management.
Asset Bundles, on the other hand, are primarily focused on packaging and loading assets efficiently. They are created during the development process and allow for modular loading and deployment of assets.
In some cases, Addressable and Asset Bundles can be used together. Developers might use Asset Bundles to package assets into separate files and then manage the loading and updating of these bundles using the Addressable system.
7fc3f7cf58