debugLayer.hide doesn't seem to work

I am trying this little piece of code in playground and I was expecting the debugger to hide after showing it:{embedMode: true});

What do I miss?

Is it not working here: Babylon.js Playground ???

Maybe a problem with a browser. Which browser do you use?

Works at home with Google chome, Opera and Firefox

I am on Chrome Version 81.0.4044.113.


Actually, also in your example, if you comment hide -> run, then comment show and uncomment hide -> run. it doesn’t hide

Add a setTimeout (). He works

This is interesting, hide only works with setTimeout. Even when I comment show, hide doesn’t work without setTimeout.

I don’t explain it either. But it works.

This is because we could face a race condition issue. The show is async and is not instantaneous. So if it takes longer than expected then hide will be executed BEFORE the layer is actually displayed

3 Likes returns a promise. So if you wanted to do something to the inspector after showing it, you can add a continuation.