Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Main Camera following wrong player in networked game

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

  1. amherst


    Dec 9, 2008
    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?

  2. LukeB


    Aug 8, 2009
    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


    Apr 8, 2014
    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.