Hello everyone,
I’ve been having this problem since today, but I can’t remember if I changed something or not…
Basically, when the 1st player’s on the room, everything’s fine. But as soon as the 2nd player enters, the cameras imediatelly switch, so the 1st player can control 2nd player’s camera, and vice-versa.
The PhotonView is correct, and camera’s owners are as well correct.
Here’s the script of spawning:
`
SpawnRand = UnityEngine.Random.Range (0, Bravosite.Length);
PlayerGO = ((GameObject)PhotonNetwork.Instantiate (“Soldier_1”,Bravosite[SpawnRand].transform.position,Quaternion.identity,0));
if(PlayerGO.GetComponent<PhotonView>().isMine == true){
((MonoBehaviour)PlayerGO.GetComponentInChildren<FPSInputController>()).enabled = true;
((MonoBehaviour)PlayerGO.GetComponentInChildren<MouseLook>()).enabled = true;
((MonoBehaviour)PlayerGO.GetComponentInChildren<MouseLook>()).enabled = true;
((MonoBehaviour)PlayerGO.GetComponentInChildren<SprintAndCrouch>()).enabled = true;
((MonoBehaviour)PlayerGO.GetComponentInChildren<ShootPlayer_UZI>()).enabled = true;
(PlayerGO.GetComponentInChildren<AudioListener>()).enabled = true;
((MonoBehaviour)PlayerGO.GetComponentInChildren<GameManager>()).enabled = true;
PlayerGO.transform.FindChild ("Main Camera").gameObject.SetActive(true);
}else{
((MonoBehaviour)PlayerGO.GetComponentInChildren<FPSInputController>()).enabled = false;
((MonoBehaviour)PlayerGO.GetComponentInChildren<MouseLook>()).enabled = false;
((MonoBehaviour)PlayerGO.GetComponentInChildren<MouseLook>()).enabled = false;
((MonoBehaviour)PlayerGO.GetComponentInChildren<SprintAndCrouch>()).enabled = false;
((MonoBehaviour)PlayerGO.GetComponentInChildren<ShootPlayer_UZI>()).enabled = false;
(PlayerGO.GetComponentInChildren<AudioListener>()).enabled = false;
((MonoBehaviour)PlayerGO.GetComponentInChildren<GameManager>()).enabled = false;
PhotonNetwork.Destroy (PlayerGO.transform.FindChild ("Main Camera").gameObject);
}
`
Am I doing something wrong??