- Home /
Images don't load after building.
Hi Guys I have this function:
IEnumerator LoadContent(string path){
WWW www = new WWW("file:///"+path);
tex = new Texture2D(64,64);
yield return www;
www.LoadImageIntoTexture(tex);
GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
cube.renderer.material.SetTexture ("_MainTex", tex);
cube.transform.position = GameObject.Find ("CubePosition").transform.position;
Vector3 size = new Vector3 (50, 50, 2);
cube.transform.localScale = size;
var shaderSprite=Shader.Find("Self-Illumin/Bumped Diffuse");
cube.renderer.material.shader = shaderSprite;
cube.transform.localRotation = new Quaternion( 0,0,180,0);
cube.AddComponent<Command> ();
cube.tag="memoryCubes";
}
}
it works perfect when y tested i the play mode, but when i Build it, the cubes dont load the testure, they load and null texture, purple texture, that means null.
Can you please tell me why?
Thanks $$anonymous$$an! Could you please put that like an answer, that solved my problem.
Answer by Fornoreason1000 · Jan 13, 2015 at 06:36 PM
Hi, may i ask what platform are you building on?
Purple texture doesn't mean null Texture, it means the shader isn't supported/ isn't running properly. the defualtDiffuse material has a null texture :).
Shaders with errors can produce the Purple texture, but if its working in the editor i can imagine it being a compatibility problem.
Mobile don't always support certain shaders due to hardware (sometimes software) limitations. Its not just mobile that can get this. old as in very old PCs with old Graphics cards will get the same issue.
also your build setting might have something to do with as well