Asset Bundles
Here’s the explanation of Asset Bundles by Unity:
An AssetBundle is content that is stored separately from a main game or application and loaded (or downloaded, in the case of mobile and online apps) at runtime. This helps minimize the impact on network and system resources by allowing customers to download and install only the parts they need. AssetBundles can also be used to update or add to content post-release.
So you got the point, it is a good thing :) As of 2018, Unity introduced Unity Addressable Asset System which provides an easier way to handle the assets according to Unity.
In this article, I will be focusing on Asset Bundles. For more information by Unity, you can simply check the link below, which also includes tutorial on how to update your Asset Bundles into Unity Addressable Asset System:
Using asset bundles, we can easily provide the user to have the ability of downloading any game object during the runtime. In the Anatomy AR game, I will be uploading the Horse prefab to be downloaded using the Asset Bundles.
First, we need to create the Asset Bundle functionality on the game object that we want to build the Asset Bundle on. On the Projects window, select the Prefab (horse in my case). On the bottom, you will realize the “AssetBundle” field (if you cannot see it, drag the preview window up). By selecting New and assigning a name, you can easily create the AssetBundle.
Now, it is time to build the asset bundle via scripting: Unity Scripting comes to the rescue. Here is the link:
As suggested, we need to create a new folder called “Editor” within the Assets and place the script within the Editor folder. And here’s the script with some adjustments:
On the Project window, you will realize the new menu item (second from the bottom):
Once you click it, you will realize a new folder is being created:
Now, all left to do is to uploading it to AWS.
Uploading the Asset Bundle to AWS
Login to aws.amazon.com and select S3, and then create a new bucket. Click on the new bucket you have created, and then click on the “Upload” button on the bottom. In this project, I have uploaded the horse (only the horse — not the manifest or meta) object.
Since I have already written an article on AWS, I will not be implementing it again in this article. You can check my article on integrating AWS and Unity from the link below: