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

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

Flaemnova
2022-06-01 03:33:28

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
2022-06-01 13:04:49

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
2022-06-15 07:25:18

Thank you!

Back to top