Error when EngineInstrumentation.captureGPUFrameTime == true

Hi all,
When I’m doing this

var instrumentation = new EngineInstrumentation(scene.getEngine());
instrumentation.captureGPUFrameTime = true;

I get the following error:

engineInstrumentation.js:54 Uncaught (in promise) TypeError: this.engine.captureGPUFrameTime is not a function
    at EngineInstrumentation.set (engineInstrumentation.js:54)
    at new PerfStats (PerfStats.ts:13)
    at Function.<anonymous> (Game.ts:259)
    at step (TurretBoomFx.ts:28)
    at (TurretBoomFx.ts:28)
    at TurretBoomFx.ts:28
    at new Promise (<anonymous>)
    at ./src/Game.ts.__awaiter (TurretBoomFx.ts:28)
    at Function../src/Game.ts.Game.initScene (Game.ts:234)
    at Function.<anonymous> (Game.ts:158)

No clue how to fix this. Any help appreciated.

ping @Evgeni_Popov

I forgot to mention that I’m on the latest BJS 5 version. What I’ve found out is that when im importing the inspector

import "@babylonjs/inspector";

the error goes away and it works. But this drags in a huge amount of additional code which bloats the final build

You can try to do:

import "@babylonjs/core/Engines/Extensions/engine.query"

I think you will also need:

import "@babylonjs/core/Instrumentation/engineInstrumentation"

Thanks @Evgeni_Popov importing @babylonjs/core/Engines/Extensions/engine.query did the trick :slight_smile:
BTW: how do I find out such hidden dependencies by myself?

This thread should help: