I’m trying to load a texture from assetbundle that successfully downloaded from a server. But the reference returns Null
Here is the code I used and failed
{
while (!Caching.ready)
yield return null;
var www = WWW.LoadFromCacheOrDownload(Url, Version);
yield return www;
if (!string.IsNullOrEmpty(www.error))
{
Debug.Log(www.error);
yield return null;
}
myAssetBundle = www.assetBundle;
_texture = myAssetBundle.LoadAsset(AssetName, typeof(Texture)) as Texture;
Material material = new Material(Shader.Find("Mobile/Bumped Diffuse"));
[CODE]
material.mainTexture = _texture;
GetComponent<Renderer>().material = material;
}
[CODE]
Any help appreciated...