[Netcode/MLAPI] network object being visible across scenes

Hi guys just a quick question concerning Netcode for those that know.

My player has network object and network transform attached to them. I attached a script to give the player the property of dontdestroyonload() and I have the option to load the player into another scene/map via a “portal” which is basically a gameobject with a boxcollider2d to detect ontriggerenter events.

What I realized now is that a network object exists across the whole server and hence is not dependent on the scene.

What this means is that player A in scene A can see player B in scene B and vice versa which is not the intended effect. Has anyone come across this particular situation or would like to share a solution to this?

I hope the attached screenshot better clarifies my situation

From what I understand, you don’t want the other player to appear once they have teleported to another scene. There are different ways to do that depending on the specific concept of your game.

The easiest way would be to make the other player invisible once he teleports to another scene. You would still receive information about this player, but the client won’t see it.

The better, but more complex way, of doing it would be to destroy the network object of the other player when they teleport and add it back when the two players are on the same scene.