[BUG] Huge input lag when using UI widget buttons β€” Also you can break player inputs entirely

So if you create buttons through Verse code, like in this tutorial, 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:

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
  2. Does anyone else find Verse UI really slow?

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

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

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)

1 Like