Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions com.unity.netcode.gameobjects/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Additional documentation and release notes are available at [Multiplayer Documen

### Changed

- 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)


## [2.5.0] - 2025-08-01

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,13 @@ public T this[int index]
}

var previousValue = m_List[index];

// Compare the Value being applied to the current value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Comment why, not what. E.g. The CHANGELOG comment above would be good as a comment here instead, for example

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As context, this was copied from the NetworkVariable implementation. I agree the comment is somewhat self-evident and likely unnecessary.

// Compare the Value being applied to the current value
if (!NetworkVariableSerialization<T>.AreEqual(ref m_InternalValue, ref value))

if (NetworkVariableSerialization<T>.AreEqual(ref previousValue, ref value))
{
return;
}

m_List[index] = value;

var listEvent = new NetworkListEvent<T>()
Expand Down