Is there a way to get current measures of a GUI control/container?

There exists private property _currentMeasure on controls. Is there a “valid” way to get the current width/height of a control?

hi. for what you need this private property?
Container - Babylon.js Documentation has many different measurments look in Accessors section

Hi @kvasss!

I don’t want to use private property and this is exactly the reason why I posted this question. I can’t see any accessors which could return me current width/height of a container.

are you look good? Container - Babylon.js Documentation and on every control you can find width and height Use the Babylon GUI - Babylon.js Documentation

Yup both width, widthInPixels and the according height properties would in your case.

@kvasss, @sebavan sorry guys for me being silly, my problem was that I was trying to use width/height accessors before my control was added to its parent with parent.addControl(). That’s made me mistakenly thinking that width/height accessors return only value that was initially set and don’t take into account responsiveness.

Thank you both for helping me out realizing my mistakes.

1 Like