Log in or register to post comments

Display 2D image in Texture

October 14, 2014 - 12:23am #1

I'm getting the image url from server in metadata. But how can i display the image from url to Texture. 

IEnumerator GetAssetBundle() {
//while(!Caching.ready)
// yield return null;
 
Debug.Log (bundleURL);
using (WWW www = WWW .LoadFromCacheOrDownload(bundleURL, Version)) {
yield return www;
Debug.Log (Version);
 
if (www .error != null)
throw new UnityException("WWW Download had an error: " + www .error);
 
AssetBundle bundle = www .assetBundle;
if (AssetName == "") {
Debug.Log ("null");
mBundleInstance = Instantiate (bundle.mainAsset) as GameObject;
 
// Instantiate((bundle.mainAsset), new Vector3(0f, 0f, 0f), Quaternion.identity);
 
mBundleInstance.transform.parent = imageTarget.transform;
mBundleInstance.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
mBundleInstance.transform.localPosition = new Vector3(0.0f, 0.15f, 0.0f);
mBundleInstance.transform.gameObject.SetActive(true);
 
}
else {
Debug.Log ("not null");
mBundleInstance = Instantiate(bundle.Load (AssetName)) as GameObject;
}
}
}
Log in or register to post comments