title: Unet, how to sync a counter to check if all players are ready
body: <p>I'm making a multiplayer bomberman game using Unet. I'm trying to create a ready check to start the game when everyone else is ready.</p>
  
  <p>I tried using a sync var,Command and Rpc calls, but nothing seems to work properly.</p>
  
  <p>When using a Cmd call this way (called when a player pushes the ready button)</p>
  
  <pre><code>[Command]
  private void CmdIncreaseReady()
  {
          IncreaseReady();
          RpcIncreaseReady();
  
  }
  [ClientRpc]
  private void RpcIncreaseReady()
  {
      IncreaseReady();
  }
  private void IncreaseReady() {
  
      playersReady++;
      //ChechAllReady();
  }
  </code></pre>
  
  <p>When pressed on the client, everyone's counter is 0 (it should be one), and when pressed on the server, the server's counter is 2 and the client 1.</p>
  
  <p>I've tried to call Cmd when !isServer and Rpc when it is, and the result is that stills doesn't update when pressed on the client, but it is updated correctly (the counter is 1 on both), when pressed on the server.</p>
  
  <pre><code>if (!isServer)
      {
          CmdIncreaseReady();
      }
      else
      {
          RpcIncreaseReady();
      }
  </code></pre>
  
  <p>If I delete the IncreaseReady() call on the Cmd, the result is the same than above.</p>
  
  <p>I've tried too to use a <code>[SyncVar]</code> to the counter, with and without a hook, passing 1 on the hook (to increment the counter that amount) and passing the already counter incremented and set variable to that number, nothing seems to work.</p>
  
  <p>I really don't know how to make it work anymore. Could someone help me? I'm really desperate with this. I've searched everywhere.</p>
  
  <p>The script is the game manager, when every client has his version, it has a Netework Identity and has Local player Authority.</p>
  
  <p>I've tried another approach, passing the increased number on the Cmd and Rpc, and inside the functions, just set the playersReady = i. Even that doesn't work.</p>
  
  <p>[UPDATE]:</p>
  
  <p>So, I've found the specific problem that I want to solve, and it's to Sync non-player objects properties.
  I've tried to spawn the Game Manager with Client Authority, and now it seems to sync correctly only on the server, the client stills doesn't call the Cmd propety.</p>
  
  <p>Looking at the Debug mode in the inspector, I've been able to see that on the server, hasAutority is true, but is false on the client.</p>
  
  <p>This is a fragment of the code on the player script where I spawn the game manager:</p>
  
  <pre><code> void Update()
  {
      if (!sceneLoaded)
      {
          if(isServer &amp; SceneManager.GetActiveScene().name == "Main Scene")
          //if (SceneManager.GetActiveScene().name == "Main Scene")
          {
              if (connectionToClient.isReady)
              {
                  var go = (GameObject)Instantiate(gameManager);
                  NetworkServer.SpawnWithClientAuthority(go, connectionToClient);
                  go.transform.SetParent(null);
                  //go.GetComponent&lt;NetworkIdentity&gt;().AssignClientAuthority(connectionToClient);
                  globalManager = go.GetComponent&lt;FSM&gt;();
  
                  //SetFSM();
  
                  sceneLoaded = true;
              }
  
          }
      }
  </code></pre>