How to detect whether keyboard/mouse or controller was interacted with last

Try this in the player controller:

There’s also nodes called was input key just released/pressed.