When using the input_trigger_device with Verse and subscribing to the events, any functions subscribed to the Pressed or Released events fires multiple times.
Steps to Reproduce
Add input_trigger_device to the map, set it up to for instance the Swap Quickbar Creative Input, set it to consume the input, for the Register Player Behavior select Required Registered and make sure it’s enabled at the start.
Create a verse device with a reference to an input_trigger_device
Create a function that prints a string.
Subscribe the created function to the input_trigger_device’s Pressed or Released event.
Register the player to the input_trigger_device OnBegin
Launch the session, press the button and notice that the function gets printed multiple times.
Expected Result
The event fires only once, running the function once and thus printing the string only once
Observed Result
The event appears to fire multiple times, running the script and print multiple times, sometimes up to 4 times!
It appears that this behavior is also observable without verse.
If one hooks up an input_trigger_device “On Input Pressed” Event to a Switch’s “Toggle State” Function and sets it up with for example Swap Quickbar Creative Input or Crouch Creative Input it will turn the switch on and then very quickly turn it off again, indicating multiple firings.
However! This whole problem does not appear to be the case for the Harvesting Tool Creative Input, which only fires the function once and properly switches the Switch’s state once per input.
For the time being I have been using a “Debounce” on the input triggers. Store a float with the current simulation time and compare the last stored time on input trigger. If no enough time has passed then I return out of the function.