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?
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” - 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’…
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.
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):