Lyra UIExtension widgets are unable to use BP input action events due to widget caching

Hi!

In Lyra, Enhanced Input bound event handlers (or even old-style key input handlers) in a user widget that is used with the UI Extension system in Lyra will work initially, but then not after changing worlds.

This is due to the input delegates for the user widget being bound in UUserWidget::NativeOnInitialized() to the input component on the owning player controller at that time.

Loading to a new level recreates the player controller and the input component, but does not update these bindings on the cached user widget that will be reused with the invalid bindings.

Caching of widgets at multiple levels ensures that the same user widget is reused and not recreated:

  • PrimaryGameLayout is cached by GameUIPolicy
  • W_ShooterHUDLayout is cached by CommonActivatableWidgetContainerBase
  • UIExtension widgets (e.g. W_Healthbar) are cached by UIExtensionPointWidget/DynamicEntryBoxBase

Many thanks,

Dave

Steps to Reproduce

  1. Open a new vanilla copy of the Lyra project in UE 5.6.
  2. Switch to the L_LyraFrontEnd level.
  3. Open up the W_Healthbar widget.
  4. In the event graph add an event handler for EnhancedInputAction IA_Jump and make it print a string to screen when triggered.
  5. Run the game in PIE.
  6. From the menu select Play Lyra -> Start a Game -> (change to Offline) Elimination.
  7. Press Jump (spacebar) and note that the string prints to screen as expected.
  8. Press Escape, select Quit Game and confirm.
  9. Repeat steps 6 and 7, but notice that the string does not print to screen as expected.

Hi,

It looks like this has been fixed in the main branch, I double checked with your repro steps and saw that the input event continued to fire on the second match despite not seeing a new call to OnInitialized (confirming that we’re using the same cached widget). If you want to backport that fix, it should be CL#44358204. Let me know if you still see issues with input event registration with that change, and we’ll investigate.

Best,

Cody

Excellent - from a quick scan of that changelist, it looks like that will fix my issue.

Thanks a lot!