Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Network variable

Discussion in 'Netcode for GameObjects' started by reiconrooc, Mar 18, 2023.

  1. reiconrooc


    Aug 11, 2018
    I am learning Netcode concepts and I have a question about network variables.
    When i chanche a value of a network variable in the server, this change is propagated on all client.
    I know that there is a callback settable when the value is changed. Can I use this callback to know that all client received the synchronization? I need to perform actions in the server after all client have received the new value of the variable. For example I need to set the current player after all players received this new value.
  2. CodeSmile


    Apr 10, 2014
    You can have each client call a ServerRPC and the server counts how many clients have sent their "receipt" status. The server would have to maintain who sent a receipt.

    However, this sounds more like you should do it with RPCs altogether. Call a ClientRPC and have each client respond with a ServerRPC to confirm the receipt of the value.
    RikuTheFuffs and afavar like this.