You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7951347
Browse filesBrowse the repository at this point in the historyBrowse files
fix: FastBufferReader offset with the default length (#4221)
* fix: FastBufferReader offset with the default length
A FastBufferReader created by copying a source with an offset and length -1 took
the whole source length as its length, so it reported offset bytes too many and
copied them from past the end of the source. Length -1 now means every byte after
the offset when copying; Allocator.None, which reads the source in place starting
at the offset, keeps the whole source length as before.
The ArraySegment<byte> overload that takes an offset now applies it from the start
of the segment instead of the start of the underlying array.
UUM-158591
* chore: CHANGELOG PR number
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
22
22
23
23
### Fixed
24
24
25
+
- Issue where a `FastBufferReader` created with an offset and the default length of -1 read past the end of its source. The `ArraySegment<byte>` overload that takes an offset now applies it from the start of the segment. (#4221)
25
26
- Issue where a client synchronized while a `NetworkList<T>` still had unsent changes applied those changes twice, resulting in duplicate entries and index-based events landing on the wrong elements on that client. (#4215)
26
27
- Issue where showing a `NetworkObject` with `NetworkShow` while its `NetworkVariable` updates were held back by `NetworkVariableUpdateTraits` stopped those pending changes from being sent until the variable was modified again. (#4215)
27
28
- Issue where moving a `NetworkObject` into another scene made the clients that did not observe it log "Trying to synchronize NetworkObjectId but it was not spawned". The scene migration is now only sent to the clients that observe the `NetworkObject`. (#4185)
/// <param name="buffer">The NativeArray to create the reader from</param>
109
119
/// <param name="copyAllocator">The allocator type used for internal data when copying an existing buffer if other than Allocator.None is specified, that memory will be owned by this FastBufferReader instance</param>
110
-
/// <param name="length">The number of bytes to read from the buffer. If set to -1, the entire buffer length will be used</param>
120
+
/// <param name="length">The number of bytes to read from the buffer. If set to -1, every byte from offset to the end of the buffer will be used</param>
111
121
/// <param name="offset">The offset into the buffer to start reading from</param>
112
122
/// <param name="internalAllocator">The allocator type used for internal data when this reader points directly at a buffer owned by someone else</param>
@@ -127,7 +137,7 @@ public unsafe FastBufferReader(NativeArray<byte> buffer, Allocator copyAllocator
127
137
/// <param name="buffer">The buffer to copy from</param>
128
138
/// <param name="copyAllocator">The allocator type used for internal data when copying an existing buffer if other than Allocator.None is specified, that memory will be owned by this FastBufferReader instance</param>
129
139
/// <param name="length">The number of bytes to copy (all if this is -1)</param>
130
-
/// <param name="offset">The offset of the buffer to start copying from</param>
140
+
/// <param name="offset">The offset into the segment to start copying from</param>
@@ -260,7 +270,7 @@ public unsafe FastBufferReader(byte* buffer, Allocator copyAllocator, int length
260
270
/// <param name="internalAllocator">The allocator type used for internal data when this reader points directly at a buffer owned by someone else</param>
@@ -285,7 +295,7 @@ public unsafe FastBufferReader(FastBufferWriter writer, Allocator copyAllocator,
285
295
/// <param name="internalAllocator">The allocator type used for internal data when this reader points directly at a buffer owned by someone else</param>
0 commit comments