Is it possible to nest GUI elements

Is there a way to nest GUI elements?
I am struggling to work out how I can render lines relatively to parent GUI element instead of the window?

Here is sample code (with in-line question in the comment)
https://playground.babylonjs.com/#UBGLKW

Any suggestions please?

I worked out when I am nesting GUI elements with addControl() method I don’t need to manually all linked elements to advanced texture. It seems to be working ok.

https://playground.babylonjs.com/#UBGLKW#1

However, connection line is not rendering until I start moving the object. Is that possible bug or am I missing something again?

The anchor and corner GUI elements need to have been rendered at least one time to have some of their properties computed and for the lines to be correctly displayed.

The easiest way I found is to delay the creation of the multiline GUI element to the next frame:

https://playground.babylonjs.com/#UBGLKW#3

1 Like

Oh yes… that makes perfect sense. Gold!
Thanks a lot @Evgeni_Popov.

I was using above method below GUI performance experiment. It would be amazing if you could have a look. Perhaps there is something I am missing.