Editorv4.0 use API : scene.debugLayer.show() ,get error

when i use the api: scene.debugLayer.show(),i get the error:

babylon.inspector.bundle.js:1 Uncaught TypeError: Cannot read property ‘GUI’ of undefined
at babylon.inspector.bundle.js:1
at babylon.inspector.bundle.js:1
(anonymous) @ babylon.inspector.bundle.js:1
(anonymous) @ babylon.inspector.bundle.js:1
debugLayer.js:97 Uncaught TypeError: Cannot read property ‘Inspector’ of undefined
at DebugLayer…/node_modules/@babylonjs/core/Debug/debugLayer.js.DebugLayer._createInspector (debugLayer.js:97)
at debugLayer.js:164
at HTMLScriptElement.script.onload (tools.js:367)

Who can help me?

Welcome aboard!

This may help you:

Thanks for your help.

But ,when I click the axis button on inspector, I get the error :

utilityLayerRenderer.js:48 Uncaught TypeError: Cannot read property ‘getEngine’ of null
at new UtilityLayerRenderer (utilityLayerRenderer.js:48)
at Function.get (utilityLayerRenderer.js:212)
at new GizmoManager (gizmoManager.js:25)
at SceneTreeItemComponent…/components/sceneExplorer/entities/sceneTreeItemComponent.tsx.SceneTreeItemComponent.setGizmoMode (babylon.inspector.bundle.max.js:58661)
at onClick (babylon.inspector.bundle.max.js:58831)
at HTMLUnknownElement.callCallback (babylon.inspector.bundle.max.js:14175)
at Object.invokeGuardedCallbackDev (babylon.inspector.bundle.max.js:14224)
at invokeGuardedCallback (babylon.inspector.bundle.max.js:14279)
at invokeGuardedCallbackAndCatchFirstError (babylon.inspector.bundle.max.js:14293)
at executeDispatch (babylon.inspector.bundle.max.js:14376)

Can you help me? Thanks.

It’s going to be hard to help without a repro as this is working in the Playground.

Hey @Evgeni_Popov
I know that this issue appears when using ES6 modules of BabylonJS. Is there a way to help you reproduce using ES6 modules? Unfortunately seems impossible with the playground

I have no idea, I’m basically a noob when it comes to packages, es6 and all those things…

Maybe @sebavan will know better?

@RaananW might also have an idea ? but a minimal repro on github would be great :slight_smile:

It feels like the umd version of the inspector is being loaded, instead of the es6. But i can’t be sure without seeing a repro.

Seeing this: Cannot read property ‘GUI’ of undefined make little to no sense in ES6, as the GUI namespace should not be assigned to the BABYLON namespace (which is probably what’s undefined here?)

1 Like