- Home /
3d text color
How do you change the color of 3d text at the start? I've tried changing the materials and using guitext but that doesn't work since it's 3d text. I also don't want it to do it onMouseEnter or anything like that I just want it to change at the very beginning. Thanks!
Answer by Eric5h5 · Mar 25, 2012 at 07:29 PM
Changing the material is correct. A 3D text object has a renderer with a material, so you change that. Naturally you have to make sure the font matches the texture used in the material.
I was doing that but it made sort of a box behind each letter and didnt actually change the color of the font. Do i need to change the font material ins$$anonymous$$d?
Answer by CreativeStorm · Mar 25, 2012 at 10:36 PM
var infoColor : int = 0;
var ColorInfo : Color = Color(0.5, 0.5, 0.5, 1);
var ColorItem : Color = Color(0.5, 0.42, 0.25, 1);
var ColorSpecial : Color = Color(0.25, 0.47, 0.5, 1);
...
if(InfoColor == 0){transform.renderer.material.color = ColorInfo;}
else if(InfoColor == 1){transform.renderer.material.color = ColorItem;}
else if(InfoColor == 2){transform.renderer.material.color = ColorSpecial;}
...
This are snippets of a code from one of my games - i use the color of the info text to indicate faster what a message it is...
Using this snippet you can define the colors in the inspector :)
You probably should cache the transform.
Answer by Streamline Games · Nov 03, 2012 at 03:45 PM
Everyone is making this too complicated, using coding. It's simple, you make a new Material, and you change the shader to GUI and then Text Shader. you then drag this onto your text. You'll see that it goes sort of weird. So you now find your font and drag the font texture onto the material. You can now choose your color, and you're done.
Answer by NChicunque · Sep 01, 2013 at 02:22 PM
Just put the alpha to 1
var miColor : Color;
function Start()
{
renderer.material.color = miColor;
//Para que se vea el texto
renderer.material.color.a = 1;
}