- Home /
Applying a Texture from an assetbundle
hey,
i've packaged my asset bundle and have this script:
#pragma strict
var Load : boolean = false;
var url:String = "localhost/Borderlands/Brdr_Textures.unity3d";
function Start ()
{
if(Load)
{
// Start a download of the given URL
var www:WWW = WWW.LoadFromCacheOrDownload (url, 2);
yield www;
var bundle:AssetBundle = www.assetBundle;
var Floor = GameObject.FindGameObjectsWithTag("Concrete_Floor");
//Load Material
Floor[0].renderer.material = bundle.Load("Mat_Concrete 1", Material);
//Load MainTexture For Material
Floor[0].renderer.material.mainTexture = bundle.Load("Tex_Concrete_Dif", Texture);
}
}
But for some reason only the material applies and not the texture.
any help would be appreciated
Have you created more than one assetbundle? It might be a dependency problem, which could be resolved by calls PushAssetDependencies before BuildAssetBundle and PopAssetDependencies afterwards.
I am facing the same problem. I have quite a lot of textures. I am able to make them work in the unity editor but not on my android phone.
maximus9600 despite this is not the right place: Graphical $$anonymous$$emory is very limited on phones. $$anonymous$$aybe you run out of vram, thus Unity cannot not load new textures into vram. Ways to overcome this limitation:
compress the texture (editor import-settings)
smaller texture size (no-$$anonymous$$der.. ;)
splitting textures (e.g. removing transparent stuff, stetching middle)
...
Thank you for your reply @JanWosnitza I know this is not the right place but I didnt get any response for a long time and I need some help immediately. I tried doing the first point you have suggested and I still see the same result :(