Journal 138 — Unity App Development, AR Demo Asset Bundle Option

Objective: To change the demo build and use an Asset Bundle

In the previous article, I got the app working in Windows. Now I want to change the app slightly by making the 3D model a Unity Asset Bundle to download from Amazon S3. This can be advantageous by making your app a smaller Play Store download, and then download a variety of 3D models or other larger assets of your choice from Amazon S3.

We can start by updating the AssetBundle tag of the 3D model.

We can create a script following Unity documentation, which will add a new menu option when selecting assets to create an Asset Bundle.

Please note the script is written to create a “StandaloneWindows” version of the Asset Bundle. We’ll eventually create another version that is suitable for an Android app.

Once this is done, you’ll see a new subfolder for the Asset Bundles.

Now in Amazon S3, we want to create a new bucket, and make it accessible for public downloads.

I also created a new IAM authorized and unauthorized role specifically for this demo and added premade Amazon policies that are for Read Only access.

After updating IAM, I went to Amazon Cognito and made a new Identity Pool for this app and added the authorized and unauthorized roles.

Back in Amazon S3, I uploaded the asset bundle from the Unity Assets.

In the file settings, you will need to edit the Access Control List (ACL) and make sure the file is set for read only access for the public.

In Unity, we need to set up a new AWSManager game object and C# script to handle the viewing and getting file, and download. To start, we need to add the AWS assemblies that we previously set up when working with a Service Adjustment app that uploaded and downloaded user data files from Amazon S3.

In the AWS Manager script, we can first make it into a singleton pattern.

Then we can set up the S3Client and S3Region properties.

We want to first make a function to confirm we can at least connect to Amazon S3 and get the file in question.

Now that this works, we can make a new function to download the asset bundle.

Now we can check this in action.

So, we end up with a successful download. The 3D model is a child of the ImageTarget. However, the size and rotation are not correct, and the Animator component reference is lost, so the UI buttons don’t work.

After the horse is instantiated, I will run a function to get the animation component reconnected in the UIManager.

Next, I will fix the scale and rotation.

Lastly, I need to fix the callout label so that the LineRenderer component shows correctly. I can fix this by finding the horse game object and finding the target which is a child of the horse.

Let’s see the results.

Note I found a couple more issues when building in Android. Essentially the Mesh Renderer, Materials, and Animator were not showing correctly. I found this issue resolved based on this discussion about one of the default Project Settings to uncheck.

Thank you for your time!




An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

WorkManagers in Kotlin with Examples

LG G8X now rolling out android 11 update in India.

LG G8X  now rolling out android 11 update in India.

Input Validator Android

Fixing flutter doctor error — java.lang.NoClassDefFoundError

Getting the Last Known Location with HMS Location Kit in Xamarin.Android

Adapting Gson to Kotlin

New year, faster builds

Display your app on multi-screen at the same time in Android

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Nielsen

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

More from Medium

Journal 137 — Unity App Development, AR Demo Add UI

Adding a ram attack to our boss

Diverging from Base Enemy Class

A Series On Creating Immersive Audio in Unity with Custom Wwise Scripts