- Home /
How to control other Clients in multiplayer
Hi,
I am trying to make a multiplayer game. I have question about NetWorkPlayer.
I am trying to access other clients by following method.
public NetworkPlayer network;
.
.
.
.
if(network == Network.Connection[0])
{
//do something
}
I have to ask you guys that this approach is right or wrong if any other method you have please tell me
Answer by Omar47i · Oct 23, 2014 at 03:34 PM
You can declare an array of NetworkPlayer and assign it with each connected client in the OnPlayerConnected(NetworkPlayer player) function, then just refer to each client by getting reference to the networkView component of a client and comparing its "owner" variable which is of type NetworkPlayer with the NetworkPlayer array you declared.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
When a client click a Canvas button, does the server receive the info? 2 Answers
Remove players and close server in Unity Multiplayer Game 0 Answers
How do I reconcile discrepancies between client side prediction and my authoritative server? 1 Answer