How to add buttons with padding in world view?

Hey hi,

so I have to create UI buttons on top of my meshes.

I have created two buttons though but I want to add more with equal distance.

now should I create more planes for each of my button but then how to add them in BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh as it accepts one mesh? or can we have muktiple dynamic textures in the scene?

What should be the best approach?

For now I am able to add three buttons max using


But I can’t add more and the distance is too much between them.

Please suggest

I did some more playaround -

is this the correct way - disclaimer - I want such UI to be the child of different meshes in my scene

Nipun David


I did a lot of experimenting and came up with this - Babylon.js Playground

but the buttons are stacking up on top of each other (I know it is stackPanel) but how to get similar alignment horizontally?

one more test - Babylon.js Playground

Nipun David

Just set panel2.isVertical = false; on your stack panel to stack elements horizontally.

You can indeed create several dynamic textures by calling GUI.AdvancedDynamicTexture.CreateForMesh several times and assign each texture to a different mesh.

1 Like

Thanks, it worked