Get the ID/name of the player that joined the game.

Hi.

How do I get the name / id of the player that joins the game?

function OnConnectedToServer 
{
    get the ID of the player
}

And another question would be…quite hard I guess, but : How do I get the player ID that collided with a certain object?

Any help greatly appreciated!

The question is answered yet: http://answers.unity3d.com/questions/47443/multiplayer-ids.html Set that question...

–

Thanks,that works!

–

1 Answer

1

Well that’s a repeated but well, if you don’t search in Google you can’t solve it by yourself…

You only had to do that:

void OnConnectedToServer() {
    print("Player ID is " + Network.player.ToString());
}

Original answer: Multiplayer ID's? - Unity Answers