UI Input events TriggerActivationEvent firing twice on trigger.

Summary

in the ui example project, the custom_button_umg_input_device script shows binding ui menus to button presses, i noticed that the input events for nexttab and previoustab fire twice, this limits the usefulness for menus with more than two tabs.

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

PlayerInput.GetInputEvents(UI.PreviousTab).TriggerActivationEvent.Subscribe(OnPrevTab)


PlayerInput.GetInputEvents(UI.NextTab).TriggerActivationEvent.Subscribe(OnNextTab)


OnPrevTab(Args: tuple(player, logic)) : void =
    Print("Previous Tab Fired")

OnNextTab(Args: tuple(player, logic)) : void =
    Print("Next Tab Fired")

Expected Result

When the input is pressed the function fires a single time

Observed Result

when the input is pressed the function is fired twice

Platform(s)

PC

Upload an image


Hi @Sleepie_zZ

What you’re seeing is caused by the print statement being placed outside the condition block, so it’s firing on every tick while the key is held down, rather than only when the condition is met. Moving the print statement inside the condition block will resolve the issue and work as expected.

We noticed that the example currently uses TriggerActivationEvent for the key press instead of BeginDetectEvent, which isn’t necessary. Functionally, it remains the same after this change. This example is scheduled to be updated in 40.40 to use the correct input event.

3 Likes

FORT-1086155 has been ‘Closed’. This is working as intended by design.