Hi there. I’ve got strange logic with sync vars.
I try to explain. I’ve got 2 sync vars.
int speed = 15;
int health = 100;
On server it’s always good. It’s math correct and etc.
But when connected new client - he got strange values of that vars, like
int speed = 187;
int health = 220;
All commands and rpc’s and all math logic work good at all clients and server. There only a glitch with correct sync values at startup.
Intresting that only client can’t get right sync values. Maybe someone knows whats wrong with conncection or something?
This is “magic”, because i add hooks to log values to handle it and to see whats wrong. At the end i fix it.
Some way my Charecter class was to big for syncronizing - there is transforms, animations, triggers, e.t.c. and that stats like speed, health. I create new network class for player prefab that contains only sync vars and it’s math\changing logics and it start to work good. I think there was some conflict in sync vars with animations(it’s bones based and there many vars on it)