MultiScene and loading of scene elements into the inspector

Hello,

If I use several scenes and want to display scene 2 being rendered in the inspector. Only the objects, GUI … of scene 1 are taken into account and not on scene 2

I must close the inspector and reopen it a second time so that scene 2 is taken into account.

Just open the inspector, scene 1 is empty, scene two has objects and GUI. Only nothing is displayed in the inspector on rendering scene 2

https://www.babylonjs-playground.com/#3VMTI9#181

In this case why not calling into the inspector API manually ? it might help you prevent scene creation order conflicts ?

This is what I do on my project, I call it after scene 2 is created and only for this scene 2 create, but it still displays scene 1 anyway.

I have to show it, hide it and show it again (the inspector) to see my scene 2

Pinging @belfortk to help on fixing it

Hi @Dad72,

One quick way to resolve your issue is by hiding then showing the inspector via code when you switch scenes. Here is a playground showing how to do that.

I’ve created a PR that adds support to more smoothly update the inspector. Once it is merged, you can replace 65-66 and 69-70 with

sceneCube.debugLayer.setAsActiveScene() and sceneSphere.debugLayer.setAsActiveScene() respectively.

1 Like

Thanks belfortk for the fix.
Does that mean i can do this :

switchDebugLayer()
	{		
		if (global.scenes[1].debugLayer.isVisible()) {
			global.scenes[1].debugLayer.hide();			
		} else {
			global.scenes[1].debugLayer.setAsActiveScene();
			global.scenes[1].debugLayer.show();
		}
	}

On my project scene 0 is used for the connection menu, game options and scene 1 is the game. I only need the inspector on the game scene.

I understand that when we change scene we can call setAsActiveScene (), but tell you about replacing debugLayer.show () and .hide (). Does setAsActiveScene () display the inspector? Or as I show in the code, I have to do it like this ?

Thanks again for the fix, I will wait for the merger, there is no rush.

setAsActiveScene() will only update the displayed Inspector. If there is no inspector, it won’t make a new one for you. You still have to first open the inspector (either with the GUI or with code).

You probably want something closer to

toggleGameSceneInspector()
	{		
		if (global.scenes[1].debugLayer.isVisible()) {
			global.scenes[1].debugLayer.hide();			
		} else {
			global.scenes[1].debugLayer.show();
			global.scenes[1].debugLayer.setAsActiveScene();
		}
	}

but it’s hard to say without seeing a playground.

1 Like

Hi @belfortk,

I still have the problem, but I understand the exact cause.

This is the Filter field at the top of the explorer panel. When I open it it is filled with my Nickname “Dad72” and I load a character who has my Nickname as a name and suddenly only the character is displayed in the liste (logic).
If I activate the inspector with embedMode on true, the Filter Field is not pre-filled, so I see all the objects in scene 2. But if embedMode = false, the Filter field is pre-filled with my nickname and just displays my Character

So the problem comes from the Filter fields which fill up on their own after I have to connect with connection fields to the game. (It must be the autocomplete which should be disabled I suppose).

The problem in pictures (This is pre-filled all by itself as the login fields with password)
0501175625

What is the problem with the filter field which is auto-filled? Can we prevent it from being auto-filled?
@belfortk, @Deltakosh

It happens when we have html connection fields? The filer field of the inspector fills it automatically then, which is rather annoying.

This is not something on our side. There must be code somewhere in your code that does it (like a getDocumentById with the name of that field)

Maybe it is a browser extension that is doing unexpected things in the background? You should try to disable all the extensions and see if it helps.

No extension, except to translate English text and to remove ads from websites.

This is normal behavior with Google chrome, the text fields followed by a password fields are pre-filled. My connection field is just before the inspector when its HML is created when it is in embed false mode.

I may have the idea of ​​creating fields hideen after my login form in order to fill in this field instead (see what it gives)

Ok, I fixed the problem like this which works well. When I activate the inspector, I create just before a hideen field in the div filter tag of the inspector.

scene.debugLayer.show(); 			
scene.debugLayer.setAsActiveScene();				
$("div.filter").prepend('<input type="text" value="" style="display:none;" /><input type="password" value="" style="display:none;" />');
1 Like