Custom cursor on hover for all Buttons

2D project. Added a few buttons, and have a custom cursor ready to use. I can easily script the change of cursor on hover for a single button. But when it comes to multiple buttons that should share the same behavior, is there a way, much like css to give all buttons a class (or Tag, i presume) and via script make them all to behave like this? Doing it manually for every single button seems wrong if they are all going to behave the same. Thanks in advance

I’m sure there’s a better way but this will work.

void InitEventTriggersForButtonEnterAndExit() {
  foreach(Button mBut in GameObject.FindObjectsOfType<Button>()) {

void AddPointerEnterAndExitDelegate(GameObject o) {
  EventTrigger trigger = o.AddComponent<EventTrigger>();

  EventTrigger.Entry entryEnter = new EventTrigger.Entry();
  entryEnter.eventID = EventTriggerType.PointerEnter;
  entryEnter.callback.AddListener( (data)=> { OnPointerEnterDelegate((PointerEventData)data);});

  EventTrigger.Entry entryExit = new EventTrigger.Entry();
  entryExit.eventID = EventTriggerType.PointerExit;
  entryExit.callback.AddListener( (data)=> { OnPointerExitDelegate((PointerEventData)data);});

Then in Your PointerEnter delegates, just use Cursor.SetCursor to set to whatever cursor you want when you hover. And on PointerExit, restore it to whatever it was.

You could use OnMouseEnter, and OnMouseExit.

OnMouseOver = Set the custom cursor.
OnMouseExit = Set it back.

Unity - Scripting API: MonoBehaviour.OnMouseOver() (references OnMouseEnter/Exit)

Then drop it on every button.

I hope that helps.