Cannot change UI visibility immediately after calling AddWidget

When a UI is created, the visibility behaviour becomes herratic, refusing to hide, unless hidden in a very specific way.

If you run the code:

PlayerUI.AddWidget(MyCanvas)
MyCanvas.SetVisibility(widget_visibility.Hidden)

the UI will not hide

If you run

PlayerUI.AddWidget(MyCanvas)
Sleep(0.0) #Sleeps 1 server update
MyCanvas.SetVisibility(widget_visibility.Hidden)

it will also not work

Instead, running

PlayerUI.AddWidget(MyCanvas)
Sleep(1.0)
MyCanvas.SetVisibility(widget_visibility.Hidden)

will work!

And finally, just cause we can’t have nice things in life, if you run

PlayerUI.AddWidget(MyCanvas)
loop:
    MyCanvas.SetVisibility(widget_visibility.Hidden)
    Sleep(1.0)

The UI will not hide, and will ignore any external attempt to hide it, unless the external attempt is specifically

MyCanvas.SetVisibility(widget_visibility.Visible)
MyCanvas.SetVisibility(widget_visibility.Hidden)

Which is quite funny if you ask me

I think this issue appeared within the past 2 updates, as that’s when I started observing this fun fun behaviour. Please help.

@Orodex Thank you for your report! Can you please re-post using the “New Issue” option on the Issues and Bug Reporting forums? Posts with this feature are connected directly into our development team so we can quickly get to them!

For more information, such as how to get the reference ID, please check out the article here: Using the Creative and UEFN Bug Reporting Form