- Home /
Question by
Blueberry_Bandit · Oct 12, 2015 at 07:47 PM ·
guitextcoloralpha
Change Alpha of Text via Code?
Alright, so I created a UI Text GameObject in the Unity Editor, which is put into the Resources folder as a prefab. At run time it's loaded in and given a parent canvas. How do I now go about changing this Text GameObject's alpha? There's no Renderer compontent, but the Text (Script) component has a Color field. However I cannot access it through the Text (Script) component.
How do I change the color from the Text (Script) component?
Comment
Best Answer
Answer by dkjunior · Oct 12, 2015 at 09:05 PM
From any script attached to this Text's gameobject:
GetComponent<Text>().color = Color.blue;
Your answer
Follow this Question
Related Questions
Alpha not working in GUITex 0 Answers
How to make a "Click to Continue" text message? 1 Answer
Change text color on GUI.Label 1 Answer
guiTexture color half alpha White? 1 Answer