Search Unity

hover.textColor not working?

Discussion in 'Scripting' started by cursedtoast, Oct 18, 2019.

  1. cursedtoast

    cursedtoast

    Joined:
    Apr 27, 2018
    Posts:
    62
    Hello,
    Forgive me as I'm a bit new to writing custom editor windows.

    I am defining a custom GUIStyle for a GUI.SelectionGrid.

    I've defined the normal.textColor successfully changing it. However, I'm setting the hover.textColor and not seeing any results.

    The end goal is to be able to hover over one of the grid buttons and have the text color change. It's remaining the color of normal.textColor, however.

    Here's my code:

    Code (CSharp):
    1.     private void InitStyles()
    2.     {
    3.         _tabStyle = new GUIStyle()
    4.         {
    5.             fontSize = 12,
    6.             alignment = TextAnchor.MiddleCenter,
    7.             margin = new RectOffset(0, 0, 10, 10)
    8.         };
    9.  
    10.         if (!EditorGUIUtility.isProSkin) return;
    11.         _tabStyle.normal.textColor = Color.white; //this works.
    12.         _tabStyle.hover.textColor = Color.blue; //doesn't work.
    13.  
    14.     }
    Is there something I'm missing? Am I misinterpreting the purpose of GUIStyle hover property?
    Thank you for your time!