Make Gui objects invisible

Hi everybody,

I just want to count all my Gui objects to make them visible or not and i don’t know how to do that.

Could you help me ?

Thanks,

Boris
.

1 Like

Hey there, you can make all of your gui controls visible or invisible by setting isVisible on the root container, like below: :slightly_smiling_face:

advancedTexture.rootContainer.isVisible = false;

Playground: https://playground.babylonjs.com/#4RTUCB#26

And if you want to iterate over all of your gui controls to determine and set their visibility one at a time you can call getDescendants() on the root container like below: :slightly_smiling_face:

advancedTexture.rootContainer.getDescendants().forEach((control) => {
    control.isVisible = false;
});

Playground: https://playground.babylonjs.com/#4RTUCB#27

2 Likes