Search Unity

Beginner - Player do all the same after spawning

Discussion in 'Multiplayer' started by Heldenwelt, Sep 28, 2015.

  1. Heldenwelt

    Heldenwelt

    Joined:
    Jul 8, 2015
    Posts:
    12
    Hi Community,

    I am new to Multiplayer. I did Tutorials that I could find. Most of them with the Beta of Unet ( I use Unity 5.2. All works so far. I have a connection and players can join. But I still have the problem that sometimes, if one player moves the others do the same. Or you have the same camera and theview is flickering between the different player views.
    I did research, but didnt find a solution so far.
    Is there a hint that you can give me? Something I can read or a could sample. It has to be First Person. I want to understand it.
    I did delete the players from scene and my prefab players has deactivated camera and player controls. And I have script that starts both (3...I forgot the AudioListener) if a new player spawns.
    - I still have the Error, that more then one AudioListener is in the Scene. Is there something in Unet. Is everything becoming an ID, or how is the trick?

    Please, how is the best way to solve it? I can think of a counter somehow( palyer1, player2 and so on). Whats the technik?

    Thanks,

    Ralf
     
    Last edited: Sep 28, 2015
  2. genocidalvirus

    genocidalvirus

    Joined:
    Jul 28, 2015
    Posts:
    4
    They're are a few google tutorials online for this. First you have to be "using" the networking in your script then instead of mono behavior you want it to come from network behavior. Then whereever your movement code is you will want to put if (islocalplayer) before it. Hope that helps.
     
  3. Heldenwelt

    Heldenwelt

    Joined:
    Jul 8, 2015
    Posts:
    12
    Hi and thanks for the help,

    it works. Hurray. I wrote a little script with "if(islocalplayer)" and switched the stuff with the help of this script during spawning on (Camera, audioListener and so on).

    Its a lot of fun, if it works ...