Please Need Help, asset bundle

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...

My problems with this post:

  • Title - It NEEDS to be useful, so other people don’t need to look at the post itself to decide, if they can even remotely help you (Developer Network Rules/ “The do’s”/5.)
  • Using code tags properly - Unity Engine - Unity Discussions - Your code is hard to read this way, please follow the steps in the link
1 Like

Make sure you actually have a Texture in the asset bundle. Make sure the assetname matches the name of the texture. Make sure you are getting the proper assetbundle. Double check all these things to ensure you are getting what you expect to get.