Sign in to follow this  
Gil

GUI - Rectangle autosize from child + full hide

Recommended Posts

Gil    3

Hello everyone,

I'm migrating a script from canvas2d to the new gui. So far so good but I still get some questions.

For the first question, I made a basic PG. I would like to know if it's possible to have a rectangle that will adjust width and height based on a textblock text size and margins.
https://www.babylonjs-playground.com/#XCPP9Y#227

 

For the second question, I had a button to disable Canvas2D like this :
canvasUI.levelVisible = 0;

I understand that's not possible with the AdvancedDynamicTexture but is there something I can use to hide everything with one command ?

 

Thanks !

Share this post


Link to post
Share on other sites
Gil    3

Hello,

 

Today I updated the script and now I have to use this :

advancedTexture._rootContainer.isVisible = false;

To make the whole GUI invisible.
That's fine by me but I can't hide the elements inside like before (the debug layer is broken so maybe tomorrow will be better to test further).
I was using element.isVisible and set it to true or false to hide it when necessary but I can't edit the value anymore.
I also tried on _isVisible but it doesn't work eather.

 

I don't know if gui is broken right now or if I have to do things differently.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.