I’m looking to build an inactivity timer that detects if someone hasn’t touched the application for a period of time (say, two minutes) – and if so, it will reset the state of the UI Widgets.
I’ve read through documents but I can’t seem to find where the “top-level” event handler is for the mouse – is there a class that handles all click events that I could extend, so that I could reset my timer for all click events, even if they don’t route to a button? I’m hoping that this would be in the PlayerController or HUD classes so that it’s relatively easy for me to extend.
Bit of a late reply, sorry, but this might prove useful to someone in future. A simple way to implement this in the third player character blueprint (event graph) is by using the “Set Timer by Function Name” node, with the function name being the name of a custom event, which in your case would be for resetting the widgets but in the image it simply switches the game to a new level.
The node essentially starts a timer that runs until the time entered (in seconds) is reached, whereupon it triggers the custom event. You have to ensure that the function name is correct when entered in the node.
Call the node at Event BeginPlay to start the timer, but then also add the exact same node at the end of the mouse and/or keyboard input, which resets the timer from the beginning when there is any mouse/keyboard input. Thus if the mouse and keyboard are not touched for say 120 seconds, the custom event triggers.