Unable to open the inspector


#1

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?


#2

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.


#3

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:


#4

No problem My fault for not documenting it :slight_smile: