Asset Bundles for Unity part 2: Downloading an asset bundle from Amazon AWS.
We’re ready for our app to download our horse file! Let’s get into the AWSManager and prepare a method:
We’ll actually take an alternative route to download the object using the URL of our object. We can find that in amazons file info.
We’ll need to use a Coroutine so let’s call one from the DownloadBundle:
We’ll then use UnityWebRequestGetAssetBundle to download the file!
We assign a variable of request of type UnityWebRequest, and we’ll Get the assetbundle from the uri with the GetAssetBundle method.
To prevent errors or acting too soon is the reason we used a coroutine, we tell unity to not do anything else until the web request is done.
We then use DownloadHandlerAssetBundle to convert what’s in request and place it into ‘bundle’.
Which then gets converted into a gameObject named horse.
And then gets instantiated to our imagetarget!
If all goes well, our object will appear in the editor.
and there it is! It need to be rotated and shrunk, but we’ve successfully downloaded our object from Amazon!