How to check distance between two players (photon multiplayer)

hi,
how would you check the distance between two players in photon, using vector3.distance. I’m kind off new to multiplayer.

(c#)

@arain55 Just do like normal Vector3.Distance(player1gameObject.transform.position, player2gameObject.transform.position);

You have to think of networking a little bit differently.
This of it like this: When you run your game each client creates everything on their build. All that is being passed is that data that you want, in this case the transforms of the player position. When receiving data you then apply that data to the player from it’s photon ID.

Example:
Player 2 starts his game, and then creates a instance of player 1 and 2 in his game.

  1. player 1 is at Vector(0,0,0) and
    moves to Vector(5,0,0)
  2. player 2 sees HIS instance of player
    1 still at Vector(0,0,0) becase
    nothing has been updated.
  3. Player 1 sends position of new
    vector to network.
  4. network sends to each player
    (Dependent on what RPC or what
    observe mode you have)
  5. Player 2 Receives the new vector and
    applies that vector to HIS instance
    of player 1

At any time player 1 or 2 could have done a distance check to see how far apart they are, there is little difference between networking and non networking other than the way you handle properties.