diff --git a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/AnticipatedNetworkVariable.cs b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/AnticipatedNetworkVariable.cs index eb8744f6a2..2a08293206 100644 --- a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/AnticipatedNetworkVariable.cs +++ b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/AnticipatedNetworkVariable.cs @@ -51,7 +51,6 @@ public enum StaleDataHandling #pragma warning restore IDE0001 [Serializable] [GenerateSerializationForGenericParameter(0)] - [GenerateSerializationForType(typeof(byte))] public class AnticipatedNetworkVariable : NetworkVariableBase { [SerializeField] diff --git a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariable.cs b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariable.cs index 50d30987c6..a17b70333d 100644 --- a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariable.cs +++ b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariable.cs @@ -9,7 +9,6 @@ namespace Unity.Netcode /// the unmanaged type for [Serializable] [GenerateSerializationForGenericParameter(0)] - [GenerateSerializationForType(typeof(byte))] public class NetworkVariable : NetworkVariableBase { /// diff --git a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariableSerialization.cs b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariableSerialization.cs index 1f6d5529ad..cda34a57e2 100644 --- a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariableSerialization.cs +++ b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariableSerialization.cs @@ -698,7 +698,7 @@ public unsafe void WriteDelta(FastBufferWriter writer, ref T value, ref T previo { var val = value[i]; var prevVal = previousValue[i]; - if (!NetworkVariableSerialization.AreEqual(ref val, ref prevVal)) + if (val != prevVal) { ++numChanges; changes.Set(i); @@ -723,19 +723,11 @@ public unsafe void WriteDelta(FastBufferWriter writer, ref T value, ref T previo unsafe { byte* ptr = value.GetUnsafePtr(); - byte* prevPtr = previousValue.GetUnsafePtr(); for (int i = 0; i < value.Length; ++i) { if (changes.IsSet(i)) { - if (i < previousValue.Length) - { - NetworkVariableSerialization.WriteDelta(writer, ref ptr[i], ref prevPtr[i]); - } - else - { - NetworkVariableSerialization.Write(writer, ref ptr[i]); - } + writer.WriteByteSafe(ptr[i]); } } }