title: Unity: Individual Camera in Multiplayer
body: <p>I have been working in unity for a little while now, and have gotten a basic multiplayer setup to work, from following <a href="http://cgcookie.com/unity/2011/12/20/introduction-to-networking-in-unity/" rel="nofollow">this</a> tutorial. However, I want to add a couple more things, one of them being a camera to follow each player. I have looked this up already and even found a comment from the creator of that tutorial. So I followed what he explained, and have this code:</p>
  
  <pre><code>function spawnPlayer(){
      var player:GameObject=Network.Instantiate(playerPrefab,spawnObject.position,Quaternion.identity,0);
      Destroy(Camera.main);
      if(player.networkView.isMine){
         var playercam:Transform=player.transform.find("Camera");
         playercam.tag="MainCamera";
      }
  }
  </code></pre>
  
  <p>I forgot to mention, there is a camera parented to the player object, which is selected as the 'playerPrefab' game object.</p>
  
  <p>This kind of works, but not really. When I start a server, the camera follows you fine. However when I open another file and join that host, it starts getting all weird on me. By weird, I mean that when i move on the server game, the camera follows the server player on the client game, and when moving on the client game, the camera follows the client on the server game. To me this makes no sense.</p>
  
  <p>I'd appreciate anyone's input on this problem, or how it can be fixed. Thanks</p>