Closed KeithSwanger closed 5 months ago
I also got a sync error after this change. When the server changes the value before the object is spawned, clients do not receive this change.
If the server changes the initial value before initialization, WriteFull does return on line 351. Isn't there some way to write Unit Tests so that bugs like this don't occur? It's just not the first time I've had a game crash in my project after a FishNet update :(
God damn, i have same issue i guess, i just updated to 4.3.3 before release my last game version, and got late joiners bug
Confirm, comment if state lines on 350 fix the issue with late joiners
If the server changes the initial value before initialization, WriteFull does return on line 351. Isn't there some way to write Unit Tests so that bugs like this don't occur? It's just not the first time I've had a game crash in my project after a FishNet update :(
It's near impossible to provide unit tests for scenarios we don't know could cause problems. When we made the changes they were tested and all tests passed. If you can let me know the condition which causes this as code, I can include it in the existing tests.
I'm going to get this resolved and released by tomorrow. I'm going to also open up bounties for help on creating tests for situations which cannot simply be done through normal unit tests.
Thank you @KeithSwanger for finding this issue as well the solution. Setting to true inside SetValue should work without issue. This is resolved in 4.3.4.
PS: it should also be set as shown inside SetInitialValues as it was in the release, but as well in SetValue.
General Fish-Networking version: 4.3.3R
Description In
SyncVar.cs
,_valueSetAfterInitialized
will never get a chance to be set totrue
This manifested itself in my project as late-joining clients never getting SyncVars of previously spawned objects synced when they joined.
Replication Take a look at these two methods in SyncVar.cs
Looking at these two methods, you can see that
_valueSetAfterInitialized
will never get a chance to be set totrue
, asSetInitialValues
is only ever called whenbase.IsInitialized
is false.This means that
SyncVar.WriteFull()
will never syncSyncVars
of non-value types.Potential Fix Perhaps move the assignment into the
SetValue
method instead: