I'm trying to Sync data from the client to the server using the new Unity Networking, and I'm failing for some reason.

I've set up a prefab with a NetworkIdentity component with the attribute Local Player Authority set.

I (manually) spawn that on the server, and it is correctly propagated to the clients.

I have a couple of vars on this class, which the client sets and the server should read:

public class PlayerController : NetworkBehaviour
    [SyncVar] public bool engineOn;
    [SyncVar] public Quaternion lookAt;

The client correctly sets them, however the server never receives them, they always stay at the default value.

What might be happening?

  • \$\begingroup\$ The alternative is using Command, but I would like to understand if I can get it to work using SyncVar. \$\endgroup\$ – o0'. Jun 15 '15 at 16:56

[SyncVar] only sends messages from the server to the client. You need [Command].

  • \$\begingroup\$ You confirm this is also true even for objects with Local Player Authority? \$\endgroup\$ – o0'. Jul 8 '15 at 10:28
  • \$\begingroup\$ PS: why the downvote? \$\endgroup\$ – o0'. Jul 8 '15 at 10:28
  • 1
    \$\begingroup\$ Yes, I tested it on my cumputer and checked online document even if with Local Player Authority \$\endgroup\$ – Ricardo Jul 12 '15 at 17:18

Not sure if this has been figured out or but here goes. I dropped the [SyncVar] portion except for health and shields on players and used the following code to get by break lights to sync across network.

void LateUpdate () {

    if (isLocalPlayer) {
        if (Input.GetButton ("Fire1")) {
            breakLightsOnOff = true;
        } else {
            breakLightsOnOff = false;
        CmdBLC (breakLightsOnOff);

void CmdBLC(bool OnOff) {
    RpcBreakLightControl (OnOff);

void RpcBreakLightControl(bool OnOff) {
    breakLights.SetActive (OnOff);
  • \$\begingroup\$ This was a huge help for me as I was using Command methods and SyncVars but hadn't used Rpc methods \$\endgroup\$ – SuckerForMayhem Mar 1 '17 at 3:48

The problem is that Server will never receive these updates unless there is a LocalClient on the machine running the server. Refer unity docs for the word Host i.e. Sever and a Client

  • \$\begingroup\$ So, local authority has no effect on syncvars? That would be very counter-intuitive… \$\endgroup\$ – o0'. Jun 21 '15 at 8:16
  • \$\begingroup\$ The intension was to be able to turn any Single Player Game to Multiplayer in a few hours. If there is a client on the Server as well, one does not have to write special code for remote client and local client. It may be Counter-Intuitive but it is Productive. This way games can have dedicated servers. \$\endgroup\$ – Sri Krishna Paritala Jun 21 '15 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.