Hello
I have two players, one of them is host and second one want to change variables on all players.
How can I change var on all players from client? I need that because I’am developing simple pause network system. Anyone can help me? Thanks a lot!
You are meant to use the SyncVar attribute.
[SyncVar] bool pause;
It will automatically keep clients updated with the value of the variable on the server. Additionally you can add a hook function if you want the client to know when the value changes:
[SyncVar(hook = "OnPause")] bool pause; void OnPause(bool newValue) { print("Pause is now: " + newValue); }