Search Issue Tracker

In Progress

Fix In Review for 2021.3.6f1, 2022.2.X

Votes

13

Found in

2021.3.5f1

2022.2.0a17

Issue ID

UUM-2468

Regression

Yes

Button isn't highlighted when the mouse re-enters the Button's Child Image, which is set as Button's Target Graphic

--

-

Reproduction steps:
1. Open the attached project
2. Enter Play Mode
3. Hover the cursor over the white part of the Button in the Game View
4. Hover the cursor over the red square of the Button in the Game View
5. Hover the cursor back to the white part of the Button in the Game View
6. Observe the Button

Expected result: the white part of the Button should be highlighted
Actual result: the white part of the Button is not highlighted

Reproducible with: 2021.2.17f1, 2021.2.19f1, 2021.3.1f1, 2022.1.0f1, 2022.2.0a11
Not reproducible with: 2019.4.38f1, 2020.3.33f1, 2021.2.16f1

Note: this only happens when the Button's "Target Graphic" is set to a Button's Child Image GameObject and not to the Image Component attached to the Button

  1. Resolution Note (fix version 2022.2):

    uGUI: Reverted the default behavior for UI elements that implement IPointerEnter/Exit back to what it was before: when hovering a child component, it also sends the hovering event to the parent(s).

    Also added a field (sendPointerHoverToParent) in the BaseInputModule that can be set to false to change the behavior to: when hovering a child component, it doesn't send the hover event to the parent(s).

  2. Resolution Note (fix version 2021.3.6f1):

    uGUI: Reverted the default behavior for UI elements that implement IPointerEnter/Exit back to what it was before: when hovering a child component, it also sends the hovering event to the parent(s).
    Also added a field (sendPointerHoverToParent) in the BaseInputModule that can be set to false to change the behavior to: when hovering a child component, it doesn't send the hover event to the parent(s).

Comments (2)

  1. zeevasilyev

    Jun 08, 2022 14:42

    One more thing, this issue also has several other side-effects related to disabling the EventSystem. More specifically when a user calls EventSystem.current.enabled = false; The EventSystem tries calling OnPointerExit on whatever is currently hovered, however, because of this bug it fails and the hovered object will stay highlighted the whole time.

  2. zeevasilyev

    Jun 08, 2022 14:34

    This issue happens because of how the IPointerEnterHandler and IPointerExitHandler are invoked. Any child gameobject with enabled Raycast Target property will effectively steal the IPointerEnterHandler and IPointerExitHandler calls even if the child does not implement these. Moreover, the parent will never receive the IPointerEnter and IPointerExit callbacks again even after the cursor is moved from the child element back to the parent.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.