- Home /
Changing 3DText color through C# script (non-GUI)
I have placed 3DText objects as part of the scene and I want a script to change the text colour once an event occurs. I know how to change a shader:
renderer.material.shader = newShaderRef;
How do I tell it to change the text color? I want it to be black and fully visible, so it's 0's all around. The script is assigned to the text object.
Edit:
GUIText.font.material.color
I found this for GUI text. But since my text isn't placed in GUI (it's an object in the 3D space), it doesn't work...
Comment
Best Answer
Answer by Berenger · Mar 02, 2012 at 06:36 PM
// assuming the shader's property's name is _Color
renderer.material.SetColor( "_Color", Color.black );
or the shortcut :
renderer.material.color = Color.black;
Your answer
![](https://koobas.hobune.stream/wayback/20220613064707im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
3d text color 4 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
I want to change my 3D Text's color when mouse over. 1 Answer