I have a main camera in a multiplayer scene and when a player joins he owns that camera so there is always a single camera.

Now when i click "disconnect" and connect again, there is no camera left in the scene because it gets "destroyed" with the players prefab.

How can i catch the "client disconnect" on client side to clear the cameras parent so that it still remains in the scene?

  • \$\begingroup\$ In multiplayer a lot is a illusion so even if the camera is on the player you still need to check if it's the localPlayer and return out of the loop if it is not. Also note you want to instanstiate from the prefab so when you destroy it you can re-instantiate again when you re-connect. The behavior you are describing sounds like you are spawning the object from the scene not the prefab and thats how the camera dissapears when destroyed. Hope that helps although I am guessing since I haven't seen your code yet. \$\endgroup\$ Apr 26, 2019 at 14:00
  • \$\begingroup\$ Thank you, so i cant simply clear the parent or catch the event? I just ask again because it would be much easier than rewrite everything. \$\endgroup\$
    – MBrain
    Apr 26, 2019 at 17:31

1 Answer 1


Instead of having the player own the camera you can make the player own a camera position and have the main camera follow its position and orientation. Then when the player is destroyed only his cameraPosition is destroyed and the main camera can then fall back to another position and orientation.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .