Ok, so I have a bool turning true upon clicking of a button, and onGUI I of course have an if statement that when said bool is true to display a label, i.e. Code (CSharp): GUI.Label(new Rect((Screen.width / 2 - 100), (Screen.height / 2), 200, 200), "Text Here!"); But how do I color said text and only said text? I know there's GUI.Color, etc. but that changes the whole GUI color. I'm looking for just setting a custom color to text on-screen. Not sure if it's possible with GUI.Label or I use something else? Or try maybe the new UI added in 4.6?
If you use the 4.6 UI system its trivial. Remove OnGUI and just use the Canvas that gets created with the new UI built from Unity. To create a 'Label' in your GUI script create a field of type 'Text' then drag the 'Text' that you created in Unity via GameObject->UI->Text drag it in here and you can change the color like so. Code (CSharp): using UnityEngine.UI; // New Library for UI in 4.6 public class MyGUI : Monobehavior { [SerializeField] Text myText; void Start() { this.myText.color = Color.blue; // Change color here } } hope this helps
Thanks a lot, it actually did help cause I've never even explored the new UI features. Thanks for peaking my interest in it
Hmm could be wrong but just thinking wouldn't this again change the entire color of my GUI for a brief half-second and then turn it back to white/default color I have? Was looking more for a way to change the color of some text on the screen and only that text and to keep it that color throughout (while bool is true).
Thats not how UnityGUI works you know you could have just tried it, its 3 lines of code, and you'd see that theres no half-second color changes