- Home /
Cant change color of 3dText/Text Mesh
I seem to have problems changing the color of 3dtext objects.
The color property is grayed out.
Any idea on what im doing wrong?
/tax
Answer by tax 1 · Sep 27, 2010 at 09:03 AM
Meanwhile in Copenhagen....
I made a C# script with the following code:
using UnityEngine; using System.Collections;
public class TextColor : MonoBehaviour { public Color color; void Awake() { transform.GetComponent<MeshRenderer>().material.SetColor("_Color", color); } }
In this way I can drag it on to the 3dtext object and set its color. Remember to set the alpha color if it goes all transparent on you.
/tax
Thank you so much.
I did have a few $$anonymous$$utes of trouble since I did not read your note about setting the alpha. It would be nice if color did not go to pure transparent by default. :-)
Here's a slight mod to your script that I am now using: public Color color = new Color(1,0,1,1); // Default to RGBA values of Purple (1,0,1,... and Pure Opacity 1)
Again, a big thanks to you in Copenhagen from Colorado!
Answer by Mike 3 · Sep 27, 2010 at 08:39 AM
You need to create a new material, drag in the texture for the font you're using and choose your wanted shader, then you can modify the colour
Add that to the Text Mesh and it should hopefully work
The mentioned font texture is created automatically when you import your ttf-Font and is added as 'child-node' of your font in the project.
And remember to set the material shader to GUI/Text Shader
Answer by NChicunque · Sep 01, 2013 at 02:31 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;
}
Your answer
Follow this Question
Related Questions
Is there a way to measure the pixel with/height of a string with a given font? 2 Answers
Sometimes the GUI selectively doesn't render some letters 1 Answer
Display TM symbol in enum on GUI 1 Answer
Odd question... can a GUIText object be displayed upside-down? 2 Answers
Possible to change GUI.Label fontsize without using GUIStyle? 1 Answer