diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index ce3051ca2e..0c77b0e77c 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. (#????) + ## [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..e47b92e9b2 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]; + + // Compare the Value being applied to the current value + if (NetworkVariableSerialization.AreEqual(ref previousValue, ref value)) + { + return; + } + m_List[index] = value; var listEvent = new NetworkListEvent()