Skip to content

Commit bb04aa9

Browse files
Merge branch 'develop-2.0.0' into feat/attachable-networkbehaviour-and-object-controller
2 parents f7a9001 + 9f7a7a8 commit bb04aa9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Additional documentation and release notes are available at [Multiplayer Documen
1919

2020
### Changed
2121

22+
- Optimized `NetworkList<T>` indexer setter to skip operations when the new value equals the existing value, improving performance by avoiding unnecessary list events and network synchronization. (#3587)
23+
2224

2325
## [2.5.0] - 2025-08-01
2426

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,13 @@ public T this[int index]
617617
}
618618

619619
var previousValue = m_List[index];
620+
621+
// Only trigger an event if the value has changed
622+
if (NetworkVariableSerialization<T>.AreEqual(ref previousValue, ref value))
623+
{
624+
return;
625+
}
626+
620627
m_List[index] = value;
621628

622629
var listEvent = new NetworkListEvent<T>()

0 commit comments

Comments
 (0)