- Home /
Question by
jnguyen54228 · Nov 07, 2018 at 01:47 AM ·
unity 5networkingmultiplayermultiplayer-networking
RPC and Command Calls OR Network messages for syncing variables across Server and Client?
I'm currently making a Unity Multiplayer game that relies on the synchronization of variables across the Server and the singular Client. I'm already able to use [SyncVar] to sync variables from the server with the client, but not the other way around. The thing is, I don't have a player prefab that spawns in the game. Am I still able to make Command and RPC calls? I tried this code below which didn't end up working when I played the game. Would Network messages work better for my situation?
bool officeBought = false;
void Update () {
if (!isServer)
{
CmdSendBuildingBought(officeBought);
}
}
[Command]
public void CmdSendBuildingBought(bool buildingBought)
{
buildingBought = true;
}
Comment