Search Unity

Listen for toggle events without breaking toggle?

Discussion in 'UGUI & TextMesh Pro' started by homer_3, Aug 26, 2021.

  1. homer_3

    homer_3

    Joined:
    Jun 19, 2011
    Posts:
    111
    If I create a toggle, if I add an EventTrigger to its label, I can no longer click on the label to have the toggle work. Is there a way to listen for event from a toggle without breaking this? When I hover over the toggle label, I want to highlight it. But soon as I try to use the event system to do that, it breaks the toggle.

    edit:
    I found a solution by using what was described in this thread https://forum.unity.com/threads/how-to-raycast-onto-a-unity-canvas-ui-image.855259/ to do my own raycasts onto the UI and dispatch events based on what I hit myself.
     
    Last edited: Aug 27, 2021