[UMG] How to fire an event on hover instead of button click?

I have spawned a number of buttons in the UI to represent a number of actors in the game world.
I want those actors to be highlighted when the player hovers the mouse over the button representing them.

I can only find an event for ‘OnClicked’ in the Designer.
How can I get an ‘OnHover’ event?

Add a Border around what you want triggering the event, bind its “OnMouseMove” to your custom event. It will now trigger whenever your mouse is over the border.

hey you think you could post a screenshot, I’m trying to make invisible screen borders that when the mouse enters them it adds rotation to the camera, think age of empires screen edge movement. How would i bind it to an event that gets called on MyCharacter?

The question is not really related to the original question, you should have made a new thread.

If you want to make invisible borders that do something on hover, you could just do something like this:

Just set their brushes to have an alpha of 0 to make them invisible, then bind their OnHover function to whatever function you have in MyCharacter that deals with camera rotation.

I have the same problem. I can’t find “OnHover” anywhere, and event created from OnMouseMove fires every tick when mouse cursor is over. Is there any UMG element that can fire only once when mouse cursor entered (exactly, “OnHover” :slight_smile: - but i can’t find any UMG element with OnHover event ) and when mouse cursor leaves it?

I see i can “Event On Mouse Enter” and “Event On Mouse Leave” but it’s related to a whole widget, so this way i would need to make separate widget for every UI element that i want to use with ‘on mouse enter’…

You could just use a bool switch.

Default the bool to false.

Have the first thing “Event On Mouse Enter” does is to check against the bool and only do the hover event if the bool is false.

Then the last thing “Event On Mouse Enter” does is set the bool to true.

It will be checking the bool every tick, but the event actions will only fire once.

Then you just need “Event On Mouse Leave” to reset the bool to false.

The buttons don’t have an OnHover event, but they do have an IsHovered member. I was able to use this to change text colors for the text object I had sitting on top of the button object (one color if true, a different if false), but you could make it do anything that way.

this is old thread but maybe this could helps. This is how i did it.

It was helpful for me, thank you!
Although you may replace that boolean with a Do Once :wink:

After going through this thread multiple times, this is how I did it.

This is a nice elegant solution. This probably should be a built in event I feel but I like this way a lot. Thanks.

WOW that is exactly what i was looking for thx!

Don’t forget you already have a built in method for detecting the beginning of a hover on almost every UMG widget: the tooltip. You can bind a function to the tooltip instead of just entering text, and that function can call a custom event in your widget graph, which can call any other custom event if you route it through the right ownership. The tooltip only initiates on hover, but it’s easy to use a delay to check for un-hovered. Plus, you don’t have to do a check every tick.

Here’s an example of how I used this to make my own tooltip widget show (since the built-in tooltip text is horribly tiny on high DPI screens):