Hi,
I’m trying the Babylon GUI. I’ve been using babylonjs ^5.0.0-beta.5 and babylonjs-gui ^4.2.1 . But everything errors out when I’m trying to create AdvancedDynamicTexture object:
const guiMenu = AdvancedDynamicTexture.CreateFullscreenUI('UI');
Once I’ve loaded this I keep getting errors:
Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘_getComponent’)
Everything works just fine on the official babylonjs 4.2.1 . Is this because of beta? Or did GUI moved in 5.0 somewhere else?
1 Like
roland
February 7, 2022, 7:01am
2
Hi!
Do you mix the two versions? It’s not a good idea
1 Like
roland
February 7, 2022, 7:06am
3
I am doing it this way so the GUI classes are in a separate namespace
import * as GUI from '@babylonjs/gui'
private _setupGUI() {
const guiTexture = GUI.AdvancedDynamicTexture.CreateFullscreenUI('UI', true, this.scene)
this.gui = guiTexture
}
This works.
1 Like
Yeah you were right, I was using two different versions. So I migrated to latest beta for all.
However it still errors out with the same error
Ok I think it was because of babylonjs and it’s working with @babylonjs /core . So when I changed the imports it all works just fine:
import * as BABYLON from '@babylonjs/core';
import { Engine, Scene, ArcRotateCamera, Vector3, Mesh, MeshBuilder, DirectionalLight, ShadowGenerator, Color4 } from '@babylonjs/core';
However with @babylon /core I don’t have access to debugLayer
roland
February 7, 2022, 7:37am
6
The inspector is a devDepedency and you have to import it from a separate package.
import '@babylonjs/core/Debug/debugLayer'
import '@babylonjs/inspector'
2 Likes
Ok it looks I have to pull everything from different modules. I’ve found this @babylonjs /inspector . Then just import everything with:
import '@babylonjs/core/Debug/debugLayer';
import '@babylonjs/inspector';
And it all works fine without any errors. Now it thinks I’m using React, but I’m using Vue. However everything seems to be working fine
roland
February 7, 2022, 7:40am
8
What does it think? You mean the console logs? The inspector is made with React. I am a Vue fanboy too
Yeah, it’s not an error. Just funny
1 Like
roland
February 7, 2022, 7:46am
10
So problem solved?
Edit: thanks for marking as a solution
roland
February 7, 2022, 9:34am
11
One more thing here. Why do you import the whole BABYLON namespace?
Yeah I thought it was a good idea at start. I got rid of that already!
1 Like
Hello everyone, I checked the steps, but I have the same problem, do you think there is another reason?
sebavan
September 13, 2022, 12:56pm
14
Could you share a repro ?
Import Error: Unable to load from /assets/babylon5/booths/stant18.gltf: Cannot read properties of null (reading ‘0’)
I don’t understand what you mean by “repro” but the error code is above
sebavan
September 13, 2022, 1:27pm
16
sorry by repro I mean, could you reproduce in the playground ? or share a github TINY project ?
At a first glance it would seem you are missing the import ‘@babylonjs /loaders’
I got it, I’m sorry for not understanding but the project is too big I’m a Jr developer so I can’t share it
I just want to summarize the problem briefly
In an area where I upload 12 objects, 1 of my objects is not always loaded due to this error 12/11 is loading 1 of them falls into the error section
We cannot unfortunately help without seeing actual code
1 Like
Dominux
December 16, 2022, 1:00pm
19
Hi, I’m using a version 5.38.0 of “babylonjs-gui”
Updating the main “babylonjs” package to to the last version has solved my problem
3 Likes