Search Unity

Question How to display the elements of a ScrollView in another color when hovering / selecting

Discussion in 'Immediate Mode GUI (IMGUI)' started by NiigataNico, Mar 21, 2023.

  1. NiigataNico

    NiigataNico

    Joined:
    Mar 21, 2023
    Posts:
    1
    Hello,

    I developed a tool for the editor that derives from EditorWindow.
    In OnGUI, I have a ScrollView which contains Labels (I have tried Boxes as well).
    I would like to change the color of the text on the Labels / Boxes depending on their state (i.e., normal, hover, selected).
    I tried defining a new GUIStyle, setting normal.textColor and hover.textColor, and passing it to the Labels / Boxes, but it is not working (the color does not change when hovering).
    Can someone shed a light on what I am doing wrong, or share a very simple example that should work?
    Thank you!