- Home /
Network.player is -1 for both instances. Unique player id?
I am launching my networked game twice, once as host and once as client. Both local player objects have the ID -1, indicating they are the server's local player, although the client obviously isn't. I need a way to tell the different clients apart, but with their local player object being the same on every instance, this isn't possible the way I wanted it to happen.
You can test it like this:
public class SomePlayerScript : NetworkBehaviour {
void Start () {
Debug.Log ("Local player: " + Network.player.ToString ());
}
}
That prints -1 on both clients.
Did you ever fix this? I'm going in circles trying to work out the same thing.
I don't remember how I worked around this, sorry
Your answer
Follow this Question
Related Questions
Sending Network player info with RPC 1 Answer
Mix unity Network Manager with own network script 1 Answer
how TargetRpc works 0 Answers
Array Index out of range on OnClientStart ? 0 Answers
Network two players collision 2 Answers