Easy way to add a listener to button hover?

Adding an OnClick listener is really straightforward: button.onClick.addListener(playSoundEffect). However I can’t find a simple way to add a listener when a user hovers over a button.

Currently I’m creating a new Entry and adding it to the button’s EventTrigger. Then I set its eventID as EventTriggerType.OnPointerEnter, then add the listener like so: entry.callback.AddListener(playSoundEffect).

Is there a more straightforward way to do this in Unity 2022.3.0, or even in a more recent release? Any help would be appreciated. Thank you.

You could declare your own IPointerEnterHandler interface. This could be on your own custom HoverHandler component, or on the class using the button itself.