2D GUI elements not hiding in 5.2.0

Hi, Babylon.js 5.2.0 is a regression for me: when I set 2D GUI elements isInvisible = false they don’t necessarily disappear.

In my app:

  • If I set GUI elements visible/invisible in response to mouse movement (mouse pointer hovers / unhovers a mesh) this works - they appear when expected and disappear when expected.
  • If I set GUI elements visible/invisible in response to keyboard (arrow keys move avatar near to / away from a mesh) this doesn’t work - they appear when expected but don’t disappear when they should. (But they subsequently disappear upon mouse hover / unhover.)

Versions 5.1.0 and 5.0.2 work OK, though.

Here is a PG that confirms the issue:

Pressing a key hides the control. Clicking the button does not.

Clicking button does work on 5.1.0.

cc @DarraghBurke

This looks to be an issue with the parent not being re-rendered correctly. A workaround for now: call control.parent.markAsDirty() after you set the visibility.

Here’s a PG: forum-29390-gui-visibility | Babylon.js Playground (babylonjs.com)

I will try to identify the cause and have a fix in shortly.

1 Like

Thanks @DarraghBurke - this one has actually totally busted our UI haha.

So sorry to hear that! Fix is in PR: [GUI] fix container regression by darraghjburke · Pull Request #12404 · BabylonJS/Babylon.js · GitHub

Will be included in the next version!

1 Like

Fix is now merged! We’ll be putting out 5.3.0 on Thursday, which will include the change. If you need a patch version earlier then that, just let me know

Awesome, thanks very much! I’ll update to version 5.3.0 when it comes out.