How to time a mouseover event?

I am trying to keep a variable “ObjectTime” that stores the time for which the player hovered over the object (mouse over). Therefore I have to start a timer on BeginMouseOver and end it on EndMouseOver and then save that certain value to a variable.
I am very new to Unreal Engine. Please help.

  • Add a float variable ObjectTime
  • In OnHovered set ObjectTime to 0.0 (If you don’t see that event yet, select your button in the designer and click the “+” next to OnHovered in the Details pane)
  • In Event Tick add Delta Time to ObjectTime if “Is Hovered” for your button is true.
  • In OnUnhovered do whatever it is you want to do with the hover time.