Search Unity

[Help] Change Button Text Color

Discussion in 'Immediate Mode GUI (IMGUI)' started by brandon199511, Jul 2, 2011.

  1. brandon199511

    brandon199511

    Joined:
    Sep 21, 2010
    Posts:
    268
    Sorry, posted in wrong section at first...

    I am reading a book for Unity Beginners and im at the point where you do GUI. It said to make a custom GUI to create a "GUI Skin" and write a code "var customSkin : GUISkin;" and link the GUI "MyGUI" (The new GUI created) with the "Custom Skin" found in the "Hierarchy". It then says to change the text color to go to the "Project" panel and chose "MyGUI" and go to the "Inspector" panel and unfold "Button" -> "Normal" -> "Text Color". I change the color to light blue "0,255,255,255" and play the game, nothing has changed. What did I do wrong?

    Here is my full code:
    Code (csharp):
    1.  
    2. var customSkin : GUISkin;
    3. function OnGUI ()
    4. {
    5.     if(GUI.Button(Rect(0,0,100,50),"Play Game"))
    6.     {
    7.         print("You clicked me!");
    8.     }
    9. }
    10.  
     
  2. AnthonyFaraci

    AnthonyFaraci

    Joined:
    Jun 26, 2011
    Posts:
    414
    In your onGUI function put this:
    Code (csharp):
    1.  
    2. GUI.skin = customSkin;
    3.  
     
  3. brandon199511

    brandon199511

    Joined:
    Sep 21, 2010
    Posts:
    268
    I later saw that in the tut, it was left out. I came to edit this but you beat me to it.

    Thanks for your answer!