Question by
Barsonax · Nov 07, 2016 at 08:33 PM ·
networkingnetworknullreferenceexception
UNET Command not working
Iam using a Command to get input from a player to the server but for some reason its not working. According to the documentation a Command is run on the server but you can pass in parameters with values from the client if i understood it correctly. However when i check this it doesnt seem to do anything on the server,
public void Update()
{
if (!isLocalPlayer) return;
//Movementinput stuff here.....
//Sync movement input to the server
CmdMove(_mouseWorldPosition, _heading);
}
[Command]
void CmdMove(Vector2 mousePosition, Vector2 heading)
{
_mouseWorldPosition = mousePosition;
_heading = heading;
}
Comment
Your answer

Follow this Question
Related Questions
Cant reference Network.Identity connectionInfo 0 Answers
Need some help with networking, Object reference not set to an instance of an object. 0 Answers
How to get OnTriggerEnter working over a network 2 Answers
Reference lost in NetworkEntity 0 Answers
Bullets not spawning in other clients but its spawning on the client that shot it. 1 Answer