Skip to content

Commit 7142b6b

Browse files
authored
fix: allow NetworkVariables containing more than 1300 bytes of data (backport) (#1725)
* fix: Allow NetworkVariables containing more than 1300 bytes of data * update `CHANGELOG.md`
1 parent 9ac9983 commit 7142b6b

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Additional documentation and release notes are available at [Multiplayer Documen
99
## [Unreleased]
1010

1111
### Added
12-
- First set of tests for NetworkAnimator - parameter syncing, trigger set / reset, override network animator (#7135)
12+
13+
- Added first set of tests for NetworkAnimator - parameter syncing, trigger set / reset, override network animator (#7135)
1314

1415
### Changed
1516

@@ -25,6 +26,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
2526
- Fixed error when serializing ConnectionApprovalMessage with scene management disabled when one or more objects is hidden via the CheckObjectVisibility delegate (#1720)
2627
- Fixed CheckObjectVisibility delegate not being properly invoked for connecting clients when Scene Management is enabled. (#1680)
2728
- Fixed NetworkList to properly call INetworkSerializable's NetworkSerialize() method (#1682)
29+
- Fixed NetworkVariables containing more than 1300 bytes of data (such as large NetworkLists) no longer cause an OverflowException (the limit on data size is now whatever limit the chosen transport imposes on fragmented NetworkDelivery mechanisms) (#1725)
2830
- Fixed ServerRpcParams and ClientRpcParams must be the last parameter of an RPC in order to function properly. Added a compile-time check to ensure this is the case and trigger an error if they're placed elsewhere (#1721)
2931
- Fixed FastBufferReader being created with a length of 1 if provided an input of length 0 (#1724)
3032
- Fixed The NetworkConfig's checksum hash includes the NetworkTick so that clients with a different tickrate than the server are identified and not allowed to connect (#1728)

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ private void NetworkVariableUpdate(ulong clientId, int behaviourIndex)
558558
// so we don't have to do this serialization work if we're not going to use the result.
559559
if (IsServer && clientId == NetworkManager.ServerClientId)
560560
{
561-
var tmpWriter = new FastBufferWriter(MessagingSystem.NON_FRAGMENTED_MESSAGE_MAX_SIZE, Allocator.Temp);
561+
var tmpWriter = new FastBufferWriter(MessagingSystem.NON_FRAGMENTED_MESSAGE_MAX_SIZE, Allocator.Temp, MessagingSystem.FRAGMENTED_MESSAGE_MAX_SIZE);
562562
using (tmpWriter)
563563
{
564564
message.Serialize(tmpWriter);

com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariableBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public abstract class NetworkVariableBase : IDisposable
1010
/// <summary>
1111
/// The delivery type (QoS) to send data with
1212
/// </summary>
13-
internal const NetworkDelivery Delivery = NetworkDelivery.ReliableSequenced;
13+
internal const NetworkDelivery Delivery = NetworkDelivery.ReliableFragmentedSequenced;
1414

1515
private protected NetworkBehaviour m_NetworkBehaviour;
1616

com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ public IEnumerator NetworkListAdd([Values(true, false)] bool useHost)
262262
}
263263

264264
[UnityTest]
265-
[Ignore("TODO: This will not currently work on v1.0.0 as the message system sends delta updates in non-fragmented messages (i.e. < 1300 bytes)")]
266265
public IEnumerator WhenListContainsManyLargeValues_OverflowExceptionIsNotThrown([Values(true, false)] bool useHost)
267266
{
268267
yield return InitializeServerAndClients(useHost);

0 commit comments

Comments
 (0)