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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

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!