Unity 2021 LTS: IPointerEnterHandler is broken


I’ve used 2021.1 for a while and I had a UI panel with a button inside it, as a child.

Both the panel and the button have their raycasts on, since both should be interactable.

I have a script with IPointerEnterHandler and IPointerExitHandler attached on the panel. Whenever you hover over the panel, the button inside it appears (so you can click it).

Now in 2021.1 it worked perfectly, I could hover over the panel and then click on the button. The IPointerEnterHandler considered the button raycast as its own - it was always like that.

However, in 2021.3, this seems to have changed. The same script and same UI no more work like that. The IPointerEnterHandler no more considers the button as its own raycast. Therefore, if you hover over the panel, it appears, but the moment you hover over the button it starts flickering. The button turns on and off every frame.

The issue is that when you hover over the button, you no longer hover over the panel, therefore the button disappears. But then you’re again hovering over the panel, so the button reappears. A loop is created.

I couldn’t find anything about this issue either in changelogs or in bug reports, therefore I’m asking here if anyone else has this issue and if anyone knows a fix for it.


Looks like now you will need to do something like this:

public void OnPointerExit (PointerEventData eventData)
        if (!eventData.fullyExited) return;
        // Do stuff you've always done