# \[BUG\] Huge input lag when using UI widget buttons — Also you can break player inputs entirely

**URL:** <https://forums.unrealengine.com/t/bug-huge-input-lag-when-using-ui-widget-buttons-also-you-can-break-player-inputs-entirely/2015799>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, bug-report, fortnite\
**Created:** [September 11, 2024, 8:23am UTC](https://forums.unrealengine.com/t/bug-huge-input-lag-when-using-ui-widget-buttons-also-you-can-break-player-inputs-entirely/2015799 "2024-09-11T08:23:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![UselessMouth](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/uselessmouth/32/976514_2.png) [@UselessMouth](https://forums.unrealengine.com/u/UselessMouth)\
**Post date:** [September 11, 2024, 8:23am UTC](https://forums.unrealengine.com/t/bug-huge-input-lag-when-using-ui-widget-buttons-also-you-can-break-player-inputs-entirely/2015799/1 "2024-09-11T08:23:27Z")

</div>

So if you create buttons through Verse code, like in [this tutorial](https://dev.epicgames.com/documentation/en-us/uefn/making-widgets-interactable-in-unreal-editor-for-fortnite), when you do something for button to appear, you wait almost **1 second** (!) to be able to see and click the button.

Same goes for button closing. When you click on a button for it to disappear you wait almost **1 second** (!!!) before it disappears and player regains control of the character.

I am 100% sure this huge lag happens because of these two functions:

```auto
player_ui.AddWidget()
# and
player_ui.RemoveWidget()

```

So I tried to use `widget.SetVisibility(widget_visibility.Collapsed)` and I got rid of the input lag, but it breaks player inputs entirely (unless I remove the widget button with `player_ui.RemoveWidget()`).

So the obvious workaround for widget to have no lag is to create it in some init stage, like at the game start, and just show/hide it when you need to, BUT you can not change `InputMode` of the widget after its creation!

All of this can be solved, if we could somehow change `ui_input_mode` of the widget after widget creation, so I could give player control when he needs to.  
Right now you can only set `ui_input_mode` in `player_ui.AddWidget()` stage and that’s all.

I am not the only one with this problem:

1. [Trying to change the InputMode := ui\_input\_mode.None](https://forums.unrealengine.com/t/trying-to-change-the-inputmode-ui-input-mode-none/1896799)
2. [Does anyone else find Verse UI really slow?](https://forums.unrealengine.com/t/does-anyone-else-find-verse-ui-really-slow/1309552)

---

<div class="post-metadata">

**Author:** ![UselessMouth](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/uselessmouth/32/976514_2.png) [@UselessMouth](https://forums.unrealengine.com/u/UselessMouth)\
**Post date:** [September 11, 2024, 6:41pm UTC](https://forums.unrealengine.com/t/bug-huge-input-lag-when-using-ui-widget-buttons-also-you-can-break-player-inputs-entirely/2015799/2 "2024-09-11T18:41:51Z")

</div>

Someone else claims that `AddWidget()` and `RemoveWidget()` also cause memory leak, slowing down the server:

> <https://gist.github.com/MattRix/912fd98e498a3e653457986bd65e8f94>

---

<div class="post-metadata">

**Author:** ![davidpkami](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidpkami/32/1040403_2.png) [@davidpkami](https://forums.unrealengine.com/u/davidpkami)\
**Post date:** [September 17, 2024, 11:07am UTC](https://forums.unrealengine.com/t/bug-huge-input-lag-when-using-ui-widget-buttons-also-you-can-break-player-inputs-entirely/2015799/3 "2024-09-17T11:07:20Z")

</div>

No way. Really? How many times we need to add and remove a widget in order to slow the server?

---

<div class="post-metadata">

**Author:** ![UselessMouth](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/uselessmouth/32/976514_2.png) [@UselessMouth](https://forums.unrealengine.com/u/UselessMouth)\
**Post date:** [September 18, 2024, 5:55am UTC](https://forums.unrealengine.com/t/bug-huge-input-lag-when-using-ui-widget-buttons-also-you-can-break-player-inputs-entirely/2015799/4 "2024-09-18T05:55:29Z")

</div>

Good question. The github file was created on 31 March 2023, maybe Verse memory management stuff got better from that time, but I feel that, looking at how slow Widget stuff works, this memory leak could still be present.

I created a bug report, it includes all the problems I wrote here, you can vote for it, if you want to: [Input lag when creating and removing widget button (Also can break player's input and potential memory leaks)](https://forums.unrealengine.com/t/input-lag-when-creating-and-removing-widget-button-also-can-break-players-input-and-potential-memory-leaks/2016748)
