Search Issue Tracker

Active

Under Consideration for 1.2.X

Votes

0

Found in [Package]

1.10

Issue ID

MTTB-284

Regression

No

Netcode for Entities: Ghost groups with dynamic buffer on child entity

Package: Unity Netcode

-

This bug was encountered when using ghost groups, where the child entity has a dynamic buffer. In my case, the ghost groups and parent/child components are setup at runtime. The error shows in the console when the buffer exceeds a certain length (20 in my case). The error message is: "InvalidOperationException: writing snapshot dyanmicdata outside of memory history buffer memory boundary".

With the attached sample project, entering playmode is enough to see the error. I have tested this with netcode for entities versions 1.0.15 and 1.2.3.

Full error:
InvalidOperationException: writing snapshot dyanmicdata outside of memory history buffer memory boundary
Assembly_CSharp.Generated.TestBufferGhostComponentSerializer.CheckDynamicDataRange (System.Int32 dynamicSnapshotDataOffset, System.Int32 maskSize, System.Int32 len, System.Int32 dynamicDataSize, System.Int32 dynamicSnapshotMaxOffset) (at NetCodeSourceGenerator/Unity.NetCode.Generators.NetCodeSourceGenerator/Assembly-CSharp/TestBufferSerializer.cs:125)
Assembly_CSharp.Generated.TestBufferGhostComponentSerializer.SerializeBuffer (System.IntPtr stateData, System.IntPtr snapshotData, System.Int32 snapshotOffset, System.Int32 snapshotStride, System.Int32 maskOffsetInBits, System.IntPtr componentData, System.IntPtr componentDataLen, System.Int32 count, System.IntPtr baselines, Unity.Collections.DataStreamWriter& writer, Unity.Collections.StreamCompressionModel& compressionModel, System.IntPtr entityStartBit, System.IntPtr snapshotDynamicDataPtr, System.Int32& dynamicSnapshotDataOffset, System.IntPtr dynamicSizePerEntity, System.Int32 dynamicSnapshotMaxOffset) (at NetCodeSourceGenerator/Unity.NetCode.Generators.NetCodeSourceGenerator/Assembly-CSharp/TestBufferSerializer.cs:286)
(wrapper native-to-managed) Assembly_CSharp.Generated.TestBufferGhostComponentSerializer.SerializeBuffer(intptr,intptr,int,int,int,intptr,intptr,int,intptr,Unity.Collections.DataStreamWriter&,Unity.Collections.StreamCompressionModel&,intptr,intptr,int&,intptr,int)
Unity.NetCode.GhostChunkSerializer.SerializeEntities (Unity.Collections.DataStreamWriter& dataStream, System.Int32& skippedEntityCount, System.UInt32& anyChangeMask, System.Int32 ghostType, Unity.Entities.ArchetypeChunk chunk, System.Int32 startIndex, System.Int32 endIndex, System.Boolean useSingleBaseline, Unity.NetCode.GhostChunkSerializer+CurrentSnapshotState& currentSnapshot, System.Byte** baselinesPerEntity, System.Int32* sameBaselinePerEntity, System.Int32* dynamicDataLenPerEntity, System.Int32* entityStartBit) (at ./Library/PackageCache/com.unity.netcode@1.0.15/Runtime/Snapshot/GhostChunkSerializer.cs:657)
Unity.NetCode.GhostChunkSerializer.SerializeGroup (Unity.Collections.DataStreamWriter& dataStream, Unity.Collections.StreamCompressionModel& compressionModel, Unity.Entities.DynamicBuffer`1[Unity.NetCode.GhostGroup]& ghostGroup, System.Boolean useSingleBaseline) (at ./Library/PackageCache/com.unity.netcode@1.0.15/Runtime/Snapshot/GhostChunkSerializer.cs:1228)
Unity.NetCode.GhostChunkSerializer.SerializeEntities (Unity.Collections.DataStreamWriter& dataStream, System.Int32& skippedEntityCount, System.UInt32& anyChangeMask, System.Int32 ghostType, Unity.Entities.ArchetypeChunk chunk, System.Int32 startIndex, System.Int32 endIndex, System.Boolean useSingleBaseline, Unity.NetCode.GhostChunkSerializer+CurrentSnapshotState& currentSnapshot, System.Byte** baselinesPerEntity, System.Int32* sameBaselinePerEntity, System.Int32* dynamicDataLenPerEntity, System.Int32* entityStartBit) (at ./Library/PackageCache/com.unity.netcode@1.0.15/Runtime/Snapshot/GhostChunkSerializer.cs:1061)
Unity.NetCode.GhostChunkSerializer.SerializeChunk (Unity.NetCode.GhostSendSystem+PrioChunk& serialChunk, Unity.Collections.DataStreamWriter& dataStream, System.UInt32& updateLen, System.Boolean& didFillPacket) (at ./Library/PackageCache/com.unity.netcode@1.0.15/Runtime/Snapshot/GhostChunkSerializer.cs:1615)
Unity.NetCode.GhostSendSystem+SerializeJob.sendEntities (Unity.Networking.Transport.NetworkDriver+Concurrent& driver, Unity.Collections.DataStreamWriter& dataStream, Unity.Entities.DynamicComponentTypeHandle* ghostChunkComponentTypesPtr, System.Int32 ghostChunkComponentTypesLength) (at ./Library/PackageCache/com.unity.netcode@1.0.15/Runtime/Snapshot/GhostSendSystem.cs:1025)
Unity.NetCode.GhostSendSystem+SerializeJob.Execute (System.Int32 idx) (at ./Library/PackageCache/com.unity.netcode@1.0.15/Runtime/Snapshot/GhostSendSystem.cs:777)
Unity.Jobs.IJobParallelForDeferExtensions+JobParallelForDeferProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.collections@2.1.4/Unity.Collections/Jobs/IJobParallelForDefer.cs:79)

Note: No test was carried out by CQA.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.