Downloading new code and data in real time for Android devices
In the event of retrieving assets from your bundles, you can use three separate functions:
AssetBundle.Load
: This will load one object only by the given name; also it will block the main thread.AssetBundle.LoadAsync
: This will load one object only by a given name; it will not block the main thread. Use this method for huge assets.AssetBundle.LoadAll
: This will load every object from yourAssetBundle
.
Use the AssetBundle.Unload
method in the event of unloading assets. Let's look at a simple usage example of the asynchronous method as shown in the following code without any exception handling and any checks (just as skeleton
):
using UnityEngine; using System.Collections; public class GetAssetBundleAsync : MonoBehaviour { public string assetBundleUrl = "http://yourweb.com/yourBundle.unity3d"; public int assetBundleVersion = 1; IEnumerator Start() { WWW www = WWW.LoadFromCacheOrDownload( assetBundleUrl, assetBundleVersion...