Use mouse to press UI button regardless of mouse position


In my current project, I’m looking to use an on-screen menu to display the player’s available actions. The player can scroll through this menu using the scroll wheel, and ideally when clicking, the highlighted button will activate and cause an appropriate action to take place. The idea is to be able to click on this button regardless of whether the mouse is highlighting the button or not, so that regardless of where the player’s cursor is located, they will always be activating the highlighted option. At the moment I’ve sort of faked this by using an index to change the texture of the highlighted button and am calling specific actions based on the index, however this has quite a few limitations that I’m finding harder and harder to ignore.

Basically, I want to use the left click of the mouse as if it’s a keyboard or gamepad button, removing the need to have the mouse highlighting the button to activate it. I don’t know if this is possible, but if it is I’d appreciate if anyone could tell me how to do such a thing.