You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Regression between comb-server and NGO network variables (#2974)
* fix: Regression between comb-server and NGO network variables
* Ensure read logic is mirrored
* Ensure read logic is fully mirrored
* fix and update
Removing the read variable type from the typed serializers.
Did a little legacy code (POC DA work) clean up in the WriteNetworkVariableData and SetNetworkVariableData methods. Also added additional information in the error logging to more easily track down where any issues might be occurring.
* fix
length safety needed to be moved into a nested if.
---------
Co-authored-by: NoelStephensUnity <[email protected]>
else// Client-Server Only: If the client cannot read this field, then skip it
1208
1236
{
1209
-
if(networkManager.DistributedAuthorityMode)
1237
+
// If skipping and length safety, then fill in a 0 size for this one spot
1238
+
if(ensureLengthSafety)
1210
1239
{
1211
1240
reader.ReadValueSafe(outushortsize);
1212
1241
if(size!=0)
1213
1242
{
1214
-
Debug.LogError("Expected zero size");
1243
+
Debug.LogError($"[{name}][NetworkObjectId: {NetworkObjectId}][NetworkBehaviourId: {NetworkBehaviourId}][{NetworkVariableFields[j].Name}] Expected zero size for non-readable NetworkVariable when EnsureNetworkVariableLengthSafety is enabled! (Skipping)");
// When EnsureNetworkVariableLengthSafety or DistributedAuthorityMode always do a bounds check
1253
+
if(ensureLengthSafety||distributedAuthority)
1236
1254
{
1237
1255
if(reader.Position>(readStartPos+varSize))
1238
1256
{
1239
1257
if(NetworkLog.CurrentLogLevel<=LogLevel.Normal)
1240
1258
{
1241
-
NetworkLog.LogWarning($"Var data read too far. {reader.Position-(readStartPos+varSize)} bytes.");
1259
+
NetworkLog.LogWarning($"[{name}][NetworkObjectId: {NetworkObjectId}][NetworkBehaviourId: {NetworkBehaviourId}][{NetworkVariableFields[j].Name}] NetworkVariable data read too big. {reader.Position-(readStartPos+varSize)} bytes.");
NetworkLog.LogWarning($"Var data read too little. {(readStartPos+varSize)-reader.Position} bytes.");
1268
+
NetworkLog.LogWarning($"[{name}][NetworkObjectId: {NetworkObjectId}][NetworkBehaviourId: {NetworkBehaviourId}][{NetworkVariableFields[j].Name}] NetworkVariable data read too small. {(readStartPos+varSize)-reader.Position} bytes.");
0 commit comments