- Home /
Question by
ZuhairGhias · May 02, 2018 at 04:31 PM ·
networkingmultiplayernetwork
Difference between connectionToClient and connectionToServer
The docs for both read the same thing. I am currently trying to use the connectionId to identify players on the network. I got a null reference error when trying to access connectionToServer inside a command but connectionToClient worked just fine. Does anyone know why?
Here is the code for reference:
private void Die(){
if(!isLocalPlayer) return;
CmdDie();
}
[Command]
private void CmdDie() {
//Null reference exception when using connectionToServer
print(connectionToClient.connectionId + "Died");
}
Comment
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Animation & sound over network 1 Answer
Syncing terrain over Network 0 Answers
Why can't my client attempt to reconnect after being disconnected? 0 Answers