- Home /
Text Mesh, change color
Hi everyone, I have this code here, attached to an object with Text Mesh ans Mesh Renderer:
function Update () {
var myTextMesh = (GetComponent(TextMesh) as TextMesh);
renderer.material.color = Color.black;
myTextMesh.text = "name";
}
Its works fine, but if change a little bit, like:
var newcolor : Color = Color.black;
function Update () {
var myTextMesh = (GetComponent(TextMesh) as TextMesh);
renderer.material.color = newcolor;
myTextMesh.text = "name";
}
or ( this is what I want )
function Update () {
var myTextMesh = (GetComponent(TextMesh) as TextMesh);
renderer.material.color = transform.parent.renderer.material.color;
myTextMesh.text = "name";
}
The text becomes invisible!!! What can I do?
Answer by Eric5h5 · Apr 21, 2010 at 05:23 PM
Presumably the color you're using has an alpha value of 0. Change the alpha of the color to 1 instead.
This was my problem too. I had used the color picker to select a color off a partially transparent object, and it set my picked color to full alpha.
Thanks man i could not figurar this out my self , thanks again
Your answer
Follow this Question
Related Questions
change button and text color together 1 Answer
change Mesh.colors over time help? 2 Answers
changing text color in GUI.Label 3 Answers
How to Make Imported MagicaVoxel 3D Object Flash White 0 Answers