I had a problem with my sync vars not syncing always check that
the class has inherited from NetworkBehaviour…
this mistake cost me hours!
Also from SyncVar Best Practices for Easy Networking - UnityStation
I note that the developers of mirror say that SyncVars should be changed only through the Hook method on the server, otherwise Server/Clients wont have their hook method being called…
- (Only if you have a hook method) The ONLY place you are allowed to change the value of the syncvar field is via the syncvar hook and only on the server! Never change the value on the client side, and never modify the field directly. If you are on the server and you want to change the field value, call the hook method and pass it the new value. This ensures that the hook logic will always be fired on both client and server side.
Suprised it doesnt start an infinite loop? Is there a way to test that its not an infinite loop?
updating a sync var in the hook should call the hook to update the sync var to call the hook which…