Input lag when creating and removing widget button (Also can break player's input and potential memory leaks)

Summary

Widget creation takes a huge processing time.

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

UI/Tools

Steps to Reproduce

Make a button like in this tutorial under «Button Interactions» — Making Widgets Interactable | Unreal Editor for Fortnite Documentation | Epic Developer Community

Expected Result

  1. Button should appear instantly on the screen after widget creation.
  2. Button should disappear instantly from the screen after widget removement.

Observed Result

  1. Player triggers something in the game that invokes button creation procedure code which includes AddWidget().
  2. Player’s input gets consumed by widget instantly, but there is no button on the screen.
  3. Player waits around 1 second, unable to do anything.
  4. Button appears on the screen allowing to interact with it.
  5. You click on a button that invokes button removing procedure code which includes RemoveWidget().
  6. Button stays on the screen around 1 second, player is unable to do anything.
  7. Player finally regains control of the character.

Platform(s)

All

Additional Notes

See the first reply for additional links.

The workaround for all of this should probably be like this:

  1. Initialize widgets on first spawn of the player.
  2. Hide the widgets until needed.
  3. Show widgets when needed, consuming player’s input for button interaction.
  4. Hide widgets when player is done with button interactions, allowing player to regain control of the character.

Though you can not use this workaround right now, because the widget consumes player’s input on its creation, disallowing to change input when needed — only by removing widget player can regain control, but removing widget process is slow and, as I found out, the widget doesn’t actually get properly removed from the memory, introducing memory leak, which can slow down the server.

You can find potential memory leak code in the first reply.

About breaking player’s input:

  1. Create widget, which consumes player’s input.
  2. Hide the widget from the screen (do not actually remove it from the code).
  3. Player is unable to do anything in-game — player can only invoke Game Menu and that is all.

My original thread with the issue:

Additional old threads:

Potential memory leak code to reproduce:

There’s an old thread about memory leak:

The status of FORT-796013 incident has been moved from ‘In Progress’ to ‘Ready for QA’. Resolution Reason: ‘Fixed’

Thank you for the report, this will be fixed in a future update.

1 Like