- Home /
Load a transparent texture by script
Hey I'm trying to load a load a texture from file and set it to have a transparent texture:
I've got as far as
WWW www = new WWW ("file://pathtomyfile" );
MeshRenderer meshrenderer = (MeshRenderer)billboard.GetComponent("MeshRenderer");
meshrenderer.material.mainTexture = www.texture;
meshrenderer.material.shader = ????
also how do i set the colour of the transparent colour (i'd like it to be white)
David
edit:
i've tried
meshrenderer.material.color = new Color(1,1,1,0);
meshrenderer.material.shader = Shader.Find("Transparent/Diffuse");
without success :*(
Comment
Best Answer
Answer by Mike 3 · Jan 13, 2011 at 04:34 PM
Your edit looks ok except for the colour line. Use Color.white instead, as the colour you're specifying now is completely invisible (0 alpha)
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How can I load pre-compressed textures at run-time (without using assetBundles) 3 Answers
Animated texture on quad 3 Answers
Load Texture at Run time from file 1 Answer
Trying to view paper object on button press GUI Texture 3 Answers