Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to change the label color of an IntField

Discussion in 'Immediate Mode GUI (IMGUI)' started by RanjPeter, Jan 14, 2017.

  1. RanjPeter

    RanjPeter

    Joined:
    Sep 1, 2016
    Posts:
    3
    How can I change the label color of an IntField in Unity? I have tried the following:

    TextFieldStyles = new
    GUIStyle(EditorStyles.numberField);
    GUI.contentColor = Color.white;
    GUI.color = Color.white;
    TextFieldStyles.normal.textColor = Color.white;
    EditorGUILayout.IntField(label,value,TextFieldStyles);​

    The only field that changes is the 'value' field. The 'label' field however, stays black. How can I change it to, for example, white?

    This doesn't work either: http://answers.unity3d.com/questions/1221395/propertyfield-label-color.html
     
  2. RanjPeter

    RanjPeter

    Joined:
    Sep 1, 2016
    Posts:
    3
    Found the answer:
    EditorStyles.label.normal.textColor = Color.white;
     
    Rachan, nandanramesh13 and ratking like this.
  3. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    637
    Thanks!!!