Camera swaps when new player joins game?

Options
when one player joins a game room, the camera will target the correct player after instantiating the player. However when a new player joins the room, the camera focuses on the new player? Also the new players camera focuses on the first player also, so effectivley both cameras switch players... spent hours googling + trying to figure this out :/ looked at the marco-polo example and did it the same way but no luck (same thing occured).

Here's my code:
// Use this for initialization
	void Start () {
        
		
		Debug.Log("1");

		playerAmount = PhotonNetwork.countOfPlayers;

		spawnPointA = GameObject.Find("SpawnPointA");
		spawnPointB = GameObject.Find ("SpawnPointB");

		ExitGames.Client.Photon.Hashtable playerProperties = new ExitGames.Client.Photon.Hashtable();
			
			GameObject player1 = (GameObject)PhotonNetwork.Instantiate("Player1", spawnPointA.transform.position, Quaternion.identity, 0);
			player1.name = PhotonNetwork.player.ID.ToString();

			Invector.CharacterController.ThirdPersonController controller = player1.GetComponent<Invector.CharacterController.ThirdPersonController> ();
			controller.enabled = true;
			Camera.main.GetComponent<TPCamera> ().target = player1.transform;
					

		

	}

Comments

  • vadim
    Options
    It looks like 'isMine' check missing when enabling controller.