On second player joining, the cameras for both players switch to the second player

Options

Hello,

I am trying to make a multiplayer game with individual players viewing their own sprite.

However, I keep facing the problem as mentioned above. Whenever a new player is spawned in. Currently, I keep the Camera as a child of each player prefab. (Both cameras remain in the scene, but both displays choose to view the newest camera)

Any advice on how to go about fixing this?

Comments

  • Isaac_Augusto
    edited June 2022
    Options

    Hi,

    If you do not intend to have something like a split screen view, there's no need to keep more than one camera.

    Keep the camera on the scene, not the prefab, and when the player enters you can use the Spawned() callback to ask the camera to follow that player.

    You can check if the Spawned player prefab is controlled by the local player checking the input authority.

    if (Object.InputAuthority == Runner.LocalPlayer)

    // Do something

    -----

    Isaac Augusto

    Photon Fusion Team

  • Flaemnova
    Options

    Thank you!