Unable to open the inspector

Hey,

Since some alpha release I’m not able to open the inspector by calling scene.debugLayer.show(). I get an error (the error is not always the same depending of the BabylonS version, this one is from the alpha.25):

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

Uncaught TypeError: Cannot read property 'Inspector' of undefined
    at DebugLayer._createInspector (debugLayer.js:69)
    at debugLayer.js:134
    at HTMLScriptElement.script.onload (tools.js:959)

I was convinced that it came from a problem of compatibility between the inspector and the core (see https://github.com/BabylonJS/Babylon.js/pull/5847) but the problem persist.

After some digging, I discover that the inspector is still requiring the old packages names babylonjs-gui, babylonjs, babylonjs-serializers, babylonjs-loaders but not the new one published in the @babylonjs/* namespace that I use now

If I add again these old packages in my package.json and force their import in my bundle in addition of the namespaced one, the inspector work again:

import {Engine, Scene, Observer} from '@babylonjs/core'
// ...
import 'babylonjs'
import 'babylonjs-gui'
import 'babylonjs-loaders'
import 'babylonjs-serializers'

I that a normal behaviour or should we use the new package names in the inspector?

So if you use the es6 version of babylon, you need to rely on the es6 version of the inspector.

you can import it for side effect only like here:

import("@babylonjs/inspector");

then you ll be able to rely on the inspector as usual.

I will add it to the doc.

Ok I just add the import '@babylonjs/inspector' and it works again:

import '@babylonjs/inspector'
import {Engine, Scene, Observer} from '@babylonjs/core'

This is a change from before where I did not have to import the inspector

A doc upgrade cool be nice on these new package :slight_smile: Thanks for your helps :+1:

No problem My fault for not documenting it :slight_smile:

I get
“Failed to resolve module specifier “@babylonjs/inspector”. Relative references must start with either …”
when following these instructions.

@Seanmclem Would be great to have more information on your setup cause it should not be a relative reference for @babylonjs/inspector.

Did you well installed both @babylonjs/core and @babylonjs/inspector ?

No I didn’t make any additional step to install it. Before in the ES5 version you just had to use it. I can do an install for it and see if that works. Is there a link to the updated Docs? Everything I have seems to be for the es5 version

the doc is part of the es6 one: ES6 - Babylon.js Documentation

The main difference than es5 is that you want to be in control of your bundle so you need to manage all the dependencies. If you are more comfortable with the es5 umd way, you can definitely use the babylonjs package and you won t need extra tooling like before.