How To Activate A UI Button Without Mouse

Hi my game is controller compatible except for the menus and I would like to allow you to use controller in the menus as well.
My menus use UI buttons is there anyway to activate them without the mouse?

Hi @WilliamBoersma31,

Are you looking to have a button event handler execute without an input event to fire?

Or enable the hover/pressed button states manually?

I would like to manually activate the pressed state

There isn’t a public API for that from what I know, you can check how the engine does it and try calling those private methods.

Something like this (untested):

// manually enable hover on button component
this.entity.button._isHovering = true;
this.entity.button._updateVisualState();

Beware that calling private API can lead to unexpected behavior.

1 Like

I may just have a collision unit under the button and make a mouse entity that can be controlled with the joy stick

Never Mind