I want to know which player i collided with (other player) on photon multiplayer network.
As far as i know, photonnetwork.player.id can only return the local player’s id. i suggest you give each player their own unique ID when they enter the server to keep track of them individually. If you need this for teams, assign each player a team when they join. This is what i do and it works perfectly then if i need to know the individual player on collision i can do something like
public void OnCollisionEnter (Collision collision)
{
playerCollisionObject = collision.gameObject;
Debug.Log(playerCollisionObject.teamID) //teamID is an int //assigned to the player when they join the lobby and their character //spawns that shows what team they're on
Debug.Log(playerCollisionObject.individualID) //teamID is an int //assigned to the player when they join the lobby and their character //spawns that shows what their individualID is.
}
//make sure when you give the player their ID it's throught a PUNRPC so all other clients know each clients ID.. if that makes sense