diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index ce3051ca2e..0e1bbc0de0 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -19,6 +19,8 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Changed +- Optimized `NetworkList` indexer setter to skip operations when the new value equals the existing value, improving performance by avoiding unnecessary list events and network synchronization. (#3587) + ## [2.5.0] - 2025-08-01 diff --git a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs index 9f0382c26a..c7c2554d21 100644 --- a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs +++ b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs @@ -617,6 +617,13 @@ public T this[int index] } var previousValue = m_List[index]; + + // Only trigger an event if the value has changed + if (NetworkVariableSerialization.AreEqual(ref previousValue, ref value)) + { + return; + } + m_List[index] = value; var listEvent = new NetworkListEvent()