- Home /
Question by
jnthn_ · Apr 13, 2015 at 06:55 PM ·
c#assetbundlewwwversionloadfromcacheordownload
AssetBundle, problem whit the version
Hi everyone, I have a problema with AssetBundle in Unity 4.6.
The file AssetBundle (ExampleAssetBundle.unity3d) change periodically, I need charge the "last versión" every time.
The application needs to work offline, for that, I use LoadFromCacheOrDownload but always loads the first version, don't know how to especify that always download the latest version.
I'm very confused with the use of AssetBundle, help me please. Thanks!
Here is a example code:
public class ChargeAssetBundle : MonoBehaviour
{
void Start ()
{
StartCoroutine (LoadAssetBundle ());
}
IEnumerator LoadAssetBundle ()
{
WWW www = WWW.LoadFromCacheOrDownload ("http://www.exampleweb.com/ExampleAssetBundle.unity3d", 1);
yield return www;
if (www.error != null) {
yield break;
}
AssetBundle bundle = www.assetBundle;
GameObject ExampleAssetBundle = bundle.Load ("ExampleAssetBundle", typeof(GameObject)) as GameObject;
GameObject newItem = Instantiate (ExampleAssetBundle) as GameObject;
newItem.transform.SetParent (GameObject.Find ("Canvas").transform, false);
www.assetBundle.Unload (false);
}
}
Comment
Your answer
Follow this Question
Related Questions
Save Hash128 from Asset Bundle Manifest 2 Answers
Multiple Cars not working 1 Answer
no extension method `LoadAssetAsync' of type `UnityEngine.AssetBundle 0 Answers
Distribute terrain in zones 3 Answers
Save a prefab from asset bundle 1 Answer