Scenes switch: Draw Calls keep growing after swtiching scene

Hello all,

Well, I integrated Babylon Js scenes switch. It works fine on the playground, but not as expected in the browser.

I download the playground and launch in the browser: When I switch to scene 0, draw calls are only 2, but when a switch to scene 1, draw calls keep incrementing to infinity.

It has no influence on the FPS but I’m wondering if it could cause some problems later.

Switch scene by pressing any key.
Here is the playground: https://playground.babylonjs.com/#MA9N02#1

Thanks for your help.

You opened the inspector with scene0 (scene0.debugLayer.show()), so it will show you the scene0 stats even if you switch to scene1 in the code.

You should reopen the inspector with the right scene when switching scene:

3 Likes

Yep, that’s right, thank you. So the draw calls has no issue.
Do you now why draw calls of scene0 (hidden scene) keeps growing up when switched to scene1 ?
This is not a bug, just wanna understand why.

That’s because calling scene0.render() notifies a certain observer (onBeforeAnimationsObservable) on which the inspector registers a callback that resets the draw call count. If scene0.render() is not called anymore (which is what happens when you switch to scene 2), this counter is not reset anymore.

That’s more clear, much thanks.