
It looks like you're new here. If you want to get involved, click one of these buttons!
I am using photon for my multiplayer fps that I am currently working on and I am having trouble with when two players with cameras spawn in, they control each other. I have read a little about disabling a camera then re enabling it but that does not seem to be working for me. Any idea on what I should do? Thanks.
Comments
Greetings,
I wonder whether player 1 controls player 2's movement or the camera? or both?
Keep on Creating!
Justin of JustinTime Studios (http://unity3d.expert)
I struggled with this problem for weeks.
Basically when you instantiate the players, both cameras are active at the same time. This causes a switch in cameras because you can also see the other players camera.
To fix this problem disable the camera component attached to the player prefab.
Then re enable only your clients camera using
public GameObject camera;
if (photonView.isMine)
camera.GetComponent<Camera>().enabled = true;
If your controls are also switched you can do the exact same thing for the movement script. When playing a game with photon, you want only your computer to have a camera and a movement script.
I hope this helps.
ps. How do you add code correctly I’m new to foruming