Search Unity

Main Camera following wrong player in networked game

Discussion in 'Connected Games' started by amherst, Jun 11, 2009.

  1. amherst

    amherst

    Joined:
    Dec 9, 2008
    Posts:
    30
    I've been playing with the sample code for the TPS-Auth and Third Person games. I've tried altering the game so that rather than have a Main Camera that follows the player with the SpringFollowCamera script, I'd like to have the Main Camera be a child of the player and follow it like that. The problem is that when I launch the game, the main camera follows the wrong player! I'm pushing the control keys to direct the player but the player in my window stands still, while the other player moves in the distance according to my keystrokes. This happens in both the Authoritative and non-Authoritative server games.

    I'm looking through the code to try to figure out why this is happening but nothing I've changed has fixed it. Anybody else have an idea?

    Thanks!
     
  2. LukeB

    LukeB

    Joined:
    Aug 8, 2009
    Posts:
    88
    Hey ^.^
    If you have made it so the camera gets instantiated with the player, then across the network another camera is being created. Because there is now 2 cameras in the scene, the game window will jump to the most recent one created :)
    As far as I am aware, the best way is to instantiate the player with the cameras locally and instantiate a player without cameras across the network via RPC :)
     
  3. buzzking

    buzzking

    Joined:
    Apr 8, 2014
    Posts:
    1
    Well, it's been ten years, but I just read this - and you fixed a problem that I've been working on for a week.

    Thanks!
    Buzz