Skip to content

Commit 347e14d

Browse files
committed
fix: missing value on NetworkListEvent for EventType.RemoveAt events server side (#2542)
1 parent 26d75b2 commit 347e14d

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
2020
- Making a `NetworkVariable` with an `INetworkSerializable` type that doesn't meet the `new()` constraint will now create a compile-time error instead of an editor crash (#2528)
2121
- Fixed the inspector throwing exceptions when attempting to render `NetworkVariable`s of enum types. (#2529)
2222
- Fixed an exception and error logging when two different objects are shown and hidden on the same frame (#2524)
23+
- Fixed missing value on `NetworkListEvent` for `EventType.RemoveAt` events server side. (#2542)
2324

2425
## Changed
2526

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,14 @@ public void RemoveAt(int index)
490490
throw new InvalidOperationException("Client is not allowed to write to this NetworkList");
491491
}
492492

493+
var value = m_List[index];
493494
m_List.RemoveAt(index);
494495

495496
var listEvent = new NetworkListEvent<T>()
496497
{
497498
Type = NetworkListEvent<T>.EventType.RemoveAt,
498-
Index = index
499+
Index = index,
500+
Value = value
499501
};
500502

501503
HandleAddListEvent(listEvent);

0 commit comments

Comments
 (0)