Search Unity

Unity multiplayer problem

Discussion in 'Multiplayer' started by timursaiap, Jun 26, 2019.

  1. timursaiap

    timursaiap

    Joined:
    Jun 25, 2019
    Posts:
    8
    i'm working on my first multiplayer game and I have a problem. Everything works fine except when I run the game in the editor and in build I control all players. I dunno what I did wrong pls help
     
  2. CarolinePalardy

    CarolinePalardy

    Joined:
    Mar 20, 2019
    Posts:
    7
    Probably because the code doesn't see a difference between the localplayer and the other one.

    Try something like

    If(!isLocalPlayer){
    Return;
    }

    In your update or wherever you control the player. It basically tells the code to stop there if it's not the local player.
     
    Joe-Censored likes this.
  3. timursaiap

    timursaiap

    Joined:
    Jun 25, 2019
    Posts:
    8
    if (!PhotonNetwork.LocalPlayer.IsLocal)
    {
    return;
    }
    Move();
    my code in update now looking like this cause I using photon to make multiplayer but still nothing, I still control both players
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Is Move() where you are getting input from the player to move the character? Might help if you were more forthcoming with the code you're having difficulty with.