Is there a way to get by name a GUI element?

Hello, ok I’m gonna be straight forward on this, it is possible to call a GUI element by name?

for context I created this GUI element let screenUI = BABYLON_GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI"); and I need to dispose of it later in another place, can I call it by the name “UI”?

I searched on the docs but it doesn’t show a function that can work on my case, or at least that’s what I thought :frowning:

1 Like

did you try getTextureByName?
Scene | Babylon.js Documentation (

Otherwise you can dispose the screenUI as that method returns the texture.


for some reason “getTextureByName” is not being recognized as a property of scene, but no worries I solved my issue, I made the value a global variable in the class and I could solve the problem in that way, but if I could need the value in another place I will have in mind that property!

Thanks anyway for the answer :smiley:


Looks like it is a 5.0 feature (I see it in the what’s new). textures is a public property on scene:

public getTextureByName(name: string): Nullable<BaseTexture> {
        for (var index = 0; index < this.textures.length; index++) {
            if (this.textures[index].name === name) {
                return this.textures[index];

        return null;

edit: if you have coalescing operator, you can just do scene.textures.find(t => === name) ?? null;