Skip to content

Commit 3307aab

Browse files
committed
fix: collection authority OnValueChanged
1 parent a06c9d8 commit 3307aab

File tree

4 files changed

+685
-489
lines changed

4 files changed

+685
-489
lines changed

com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariable.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,13 @@ public bool CheckDirtyState(bool forceCheck = false)
173173
}
174174

175175
// Compare the previous with the current if not dirty or forcing a check.
176-
if ((!isDirty || forceCheck) && !NetworkVariableSerialization<T>.AreEqual(ref m_PreviousValue, ref m_InternalValue))
176+
if ((!isDirty || forceCheck) && !NetworkVariableSerialization<T>.AreEqual(ref m_InternalOriginalValue, ref m_InternalValue))
177177
{
178178
SetDirty(true);
179-
OnValueChanged?.Invoke(m_PreviousValue, m_InternalValue);
179+
OnValueChanged?.Invoke(m_InternalOriginalValue, m_InternalValue);
180180
m_IsDisposed = false;
181181
isDirty = true;
182+
NetworkVariableSerialization<T>.Duplicate(m_InternalValue, ref m_InternalOriginalValue);
182183
}
183184
return isDirty;
184185
}

0 commit comments

Comments
 (0)