Changing Gui Text on mouse over not working for black text

void OnMouseEnter()
guiText.material.color =;

    void OnMouseExit()
        guiText.material.color =;

The above is code that I have for changing the color of my guiText on a mouse over.

My GUIText is initially set to black (0,0,0,255). However, this will not change the text to green on mouse over.

However, if I start with the text being White instead of Black, the above code works just how I want it. It even sets it to black on mouseExit and continues to work by going back to green on mouseEnter


guiText.color =;

I.e. don’t use ‘material’.

There is a better solution to change color of a GUIText :

public class OptionController : MonoBehaviour
  public Color myColor;
  public GUIText myGUIText;

  void OnGUI ()
    //everyone do this for the first time :
    myGUIText.guiText.color = myColor;
    // but it SEEMS it doesn't work !!!!!!

    // the line below work perfectly :
    myGUItext.guiText.color = new Color(myColor.r, myColor.g, myColor.b, 1);
    // MIRACLE !!! The color of your GUIText has been changed (^_^)

The issue came from the Color function. The alpha value is, by default, not set. So, the value is 0. The alpha means the transparency of the text.