GUI.AdvancedDynamicTexture.CreateForMesh makes my mesh invisible?

I’ve tried to create a block with number.
I’ve seen this example https://playground.babylonjs.com/#ZI9AK7#2103
But in my code it doesn’t work
I can’t see it in the scene

    let plane = MeshBuilder.CreateBox("plane",{size: 2}, this.scene);
    plane.position.y = 2;
    plane.rotate(new Vector3(1,0,0), 1.57);

    let advancedTexture = GUI.AdvancedDynamicTexture.CreateForMesh(plane, 1024, 1024);

    var button1 = GUI.Button.CreateSimpleButton("but1", "Click Me");
    button1.background = 'green';
    advancedTexture.addControl(button1);

Hi,
works here:

In your code you forgot BABYLON.*

2 Likes

I added BABYLON before all meshes, cameras, engine etc…
Now I have Uncaught TypeError: BABYLON.Engine is not a constructor

Do you reference the babylon library in your page ? and if so how ?

1 Like

So the problem was in the way how I import modules, Project set up guide suggested to import from babylonjs/core Getting Set Up | Babylon.js Documentation.
I replaced it with babylonjs and everything works correctly.

2 Likes