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
- Button should appear instantly on the screen after widget creation.
- Button should disappear instantly from the screen after widget removement.
Observed Result
- Player triggers something in the game that invokes button creation procedure code which includes
AddWidget()
. - Player’s input gets consumed by widget instantly, but there is no button on the screen.
- Player waits around 1 second, unable to do anything.
- Button appears on the screen allowing to interact with it.
- You click on a button that invokes button removing procedure code which includes
RemoveWidget()
. - Button stays on the screen around 1 second, player is unable to do anything.
- 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:
- Initialize widgets on first spawn of the player.
- Hide the widgets until needed.
- Show widgets when needed, consuming player’s input for button interaction.
- 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:
- Create widget, which consumes player’s input.
- Hide the widget from the screen (do not actually remove it from the code).
- Player is unable to do anything in-game — player can only invoke Game Menu and that is all.