Closed maxkratt closed 3 weeks ago
This is intended behavior as clientHost. We moved away from having separate values for clientHost as it was creating more complex code with very little benefit.
You can switch to stable mode to get the old syncVars back but at some point this will become the new default.
As stated above it's normal for 'asServer false' to show the same value when clientHost, in the newest SyncTypes.
ClientOnly seeing the same values however was an error.
The resolution is to go into SyncVar.cs and find this bit...
if (!base.NetworkManager.IsServerStarted)
UpdateValues(nextValue);
T prev = _value;
InvokeOnChange(prev, nextValue, asServer: false);
Replace with this (moving prev above if check)
T prev = _value;
/* If also server do not update value.
* Server side has say of the current value. */
/* Only update value if not server. We do not want
* clientHost overwriting servers current with what
* they just received.*/
if (!base.NetworkManager.IsServerStarted)
UpdateValues(nextValue);
InvokeOnChange(prev, nextValue, asServer: false);
Resolved in 4.5.3
General Unity version: Unity 6 (6000.0.23f1) Fish-Networking version: 4.5.2 Discord link: https://discord.com/channels/424284635074134018/1034477094731784302/1299363640188731393
Description When a SyncVar is changed the OnChange event triggers with the previous value being the same as the next value. This only happens with asServer as false. You may need to create a blank project to replicate this as it was not happening in my old testing project.
Replication Steps to reproduce the behavior:
K
key a few times to change the SyncVarExpected behavior It should be the correct previous value like happens when asServer is true.
Screenshot
Example Package SyncVarIssue.zip