Error when using AdvancedDynamicTexture

I have a model loaded in babylon successfully, with a texture applied

I want to add floating labels in the 3d space,
so I try to use

var advancedTexture = GUI.AdvancedDynamicTexture.CreateFullscreenUI(“UI”);

but every time I use that line, I get errors
either getcomponent null error or onsuccess callback error from append mesh
babylon.js:16 Uncaught TypeError: Cannot read property ‘_getComponent’ of null

what is the best way to add floating labels in 3d space without errors?
thank you very much

this is somebody elses example but they get similar error

It works if a scene is created :

thank you,
I already had a scene, in any case if I try to create a scene, it says -engine- doesn’t exist,
where is engine coming from?

yes I already had scene and engine:

const scene = new Scene(engine, sceneOptions);

  if (scene.isReady()) {

    props.onSceneReady(scene);

  } else {

    scene.onReadyObservable.addOnce((scene) => props.onSceneReady(scene));

  }

The engine is automatically created for you in the playground. If you don’t use the playground, you will need to create it yourself and pass it to the scene constructor.

One thing you can test is to pass the scene to the CreateFullscreenUI method as the 3rd parameter.

But a repro would be the way to go as it is working in the example playground provided by @Dad72.

just checked, I have scene and engine all created,
problem is that im doing react app, and I have two separate files so not sure how to include that in the playground

const onSceneReady = (scene) => {

console.log(scene);

var advancedTexture = GUI.AdvancedDynamicTexture.CreateFullscreenUI(

"UI",

1000,

1000,

scene

);

I am receiving the created scene in that event handler, and I do console log and its there.
And yet same error

in any case what i want to do is to create floating text labels in the 3d space,
I try 1000 things but I cannot make it

look just put the code here

it says GUI not found, how can I include GUI library?

and in any case how can I make floating text label positioned in 3d space without panel or button?

It’s BABYLON.GUI, not simply GUI (same thing for Vector3).

Look at the API doc for CreateFullscreenUI, you don’t pass it sizes and the scene is the 3rd parameter, not the 4th.

See your other threads for creating floating text labels (Text is not rendered, issues creating floating labels in 3d space).

1 Like

yes now it works


now i have to get rid of panel and button to have just label :slight_smile: