How to reset IsPointerOverGameObject(-1) after click?

Hello,

I want to extend a button so it reacts differently on being selected by mouse and by a controller. (It’s for moving a scroll rect with the controller - I don’t want that script to trigger when I click a button with the mouse).

Now I’ve been using eventData.currentInputModule.IsPointerOverGameObject(-1) to check if it has been clicked by a mouse. The problem is this is always true once I have done a single mouseclick.

Is there some way to either reset this to false or some other way to check if a button has been selected by mouse or not?

Alright, I found a solution of my own. Instead of trying to check if it was clicked in the eventData, I just used Input.GetMouseButton(0).

This does feel pretty hacky, but it works. In case that someone stumbles over this in five years or so, here’s what I did to extend my class:

public class SelectableButton : Button
    {
        public UnityEvent OnSelectEvent;
        public UnityEvent OnNoMouseSelectEvent;

        //Public Methods
        public override void OnSelect(BaseEventData eventData)
        {
            base.OnSelect(eventData);
            if(eventData != null)
            {
                if(!Input.GetMouseButton(0) & OnNoMouseSelectEvent != null) 
                {
                    OnNoMouseSelectEvent.Invoke();
                }
                if(OnSelectEvent != null) OnSelectEvent.Invoke();
            }             
        }
   }