Camera sync problem

Hello ! :)
I am using a firstpersoncontrols that I found on the asset store unfortunately I have problems.

When I'm alone in the room I have no problem but when a second player joins I have problems:
- When I move the camera of the first player moves the camera of the second player.
- If I move the camera of the second player the camera of the first player moves.

I was careful to use the "Is.Mine", on the script that manages the controls it works but the script that manages the camera does not work.

Here is the script in question:

I added to the original script the "Is.Mine" in the start and the update.

If anyone could help me that would be great!

Thank you in advance :)

Comments

  • Tell me a bit about your Setup. Do you spawn a Camera with a Player? usully you dont need a PhotonView for a camera.
    An easy approach ist to just leave the Camera in a Scene and the local Player should set the Camera Targt(CharacterTransform in the script) by its own, no photon view is needed. Or just spawn the Camera with the Player and set the target after instantiating.
  • S_Oliver
    S_Oliver ✭✭✭
    edited February 2019
    Take a look at my Photon Example Project.
    https://github.com/SradnickDev/Photon-Example/blob/master/Assets/Scripts/Camera/BasicCameraBehaviour.cs
    The Camera dont has a PhotonView.
    And thats the way i spawn the player and camera and setup everything.
    https://github.com/SradnickDev/Photon-Example/blob/master/Assets/Scripts/PlayerHandler.cs
  • Thank you for your reply ! So I'm back on the standard asset

    Regarding my configuration, I have my player with a camera and I have a script that is on the player and that controls the camera.

    I use the first person character of the standard asset of Unity.

    I also add a photon view and the function "Is.Mine" in the script that manages the controls of the character.

    Here is the prefab of my player:


    This is my player's inspector:


    To adapt the first person controller of the standard asset, you must add "if (view.IsMine)" ?