- Home /
Question by
st4z · Jul 06, 2018 at 03:26 AM ·
networkingsynchronization
SyncVar Hook change variable at the end on host.
I called syncvar hook via command, and i know what to do: manually change variable... but on host it is not necessary!
[SyncVar(hook = "onChangeExp")] public int exp = 0;
[SyncVar] public int expMax = 100;
void onChangeExp(int newExp) {
exp = newExp;
if (exp >= expMax) { // it's level up
exp = exp - newExp; // it will change variable but...
}
} // as if here (at the end) launch this line: exp = newExp;
I can't change variable on my own value... its change on new value at the end. How fix this?
Comment
Your answer
Follow this Question
Related Questions
RPC or Synchronization ? 1 Answer
Network rotation is laggy and slow 2 Answers
ScriptableObjects and SyncVars, is it posible? 1 Answer
SyncVar works with disabled components? 0 Answers
Changing rooms and spawning players with Multiplayer Example 2 Answers