How to retrieve get the AdvancedDynamicTexture that any GUI Control rootContainer descendant is linked to?

Hi all,

Given any GUI Control in the GUI hierarchy (the “this”) I would like to retrieve the AdvancedDynamicTexture “that” this GUI Control belongs to according to the inspector (see the red arrow in the drawing):
image
I seem to be able to traverse the Controls tree upwards using the parent field of Control until I reach the ‘root’. But the rootContainer of an AdvancedDynamicTexture doesn’t seem to have a field that points back to the AdvancedDynamicTexture it is a member of, right? (So that is my feature request.)

A temporary work around for me is to get all the textures in the scene, then traverse each AdvancedDynamicTexture in the scene on the rootContainer to find “this” GUI Control as a child. Though that would be poor performance as it has to traverse down many trees and child nodes.

Or to add a line of code after creation of the texture to manually set a new custom e.g. ‘_advancedDynamicTexture’ property of the rootContainer and point that to the AdvancedDynamicTexture. (That would probably be a possible technical solution for the feature request to do inside the CreateFullscreenUI function.)

I am using multiple AdvancedDynamicTextures in my app in order to support split-screen local multiplayer with custom viewports and layermasks.

Q

Hi. You can get all elements with advancedDynamicTexture.getDescendants() AdvancedDynamicTexture | Babylon.js Documentation

Thanks @kvasss for taking the time and effort to reply to my message.

Your solution does not help me in this case. My question/request is the other way around. See the direction of the red arrow I drew in the picture.

So given any descendant Control, how to know the AdvancedDynamicTexture?

The host property of any GUI control is the ADT to which this control belongs to.

@Evgeni_Popov Excellent, yes that seems to be the property I am looking for!

I must have missed that one while scanning through the API/codebase.

Thanks, so the feature was already there.