#Syncvar sync intervals

5 messages · Page 1 of 1 (latest)

cursive mantle
#

Hello friends
I been lookin at the Fishnet docs on syncvars and I wanted to clarify the interval input property.
For example,

private readonly SyncVar<float> _health = new SyncVar<float>(new SyncTypeSettings(1f);

private void Awake()
{
_health.OnChange += on_health;
}

This is the example on the docs.

Does this 1f mean

  1. it only syncs every 1 second AND when the value changes?
  2. It syncs 1 second AFTER the value changes?
  3. It syncs in 1 second intervals when the value changes?

Is there a setting to make the syncvar ONLY SYNC on change? Meaning that there is no need for this 1f input?

Thank you (:

soft raptor
#

You can use the SendRate setting to delay updates to clients by 1 second for example. So let's say you may change your SyncVar several times a second, but only need a client to know about the changes every second or so, then you can use the SendRate.

soft raptor
#

So with your example, every second if the value is currently different from the last time it synced it will sync.

cursive mantle
#

Aaaahhh ok ok i understand (:
thank you for the swift reply!