CreateImageButton not appearing

Hi all,

I’m having a bit of trouble adding a button to my scene.

I’m trying to add the code from the Documentation (Use the Babylon GUI - Babylon.js Documentation) currently:

var button = BABYLON.GUI.Button.CreateImageButton( "but", "Click Me", "textures/grass.png" );

I have no errors and have added the GUI module yet I cannot see that the button has been added. Am I missing an extra step somewhere?


Hard to say if this is exactly your problem, but you do need to create the UI before adding elements to it:

var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI(“UI”);
var button = BABYLON.GUI.Button.CreateImageButton( “but”, “Click Me”, “textures/grass.png” );


Thank you, this is what I was missing.