Just thought I’d post my case on the forum.
What happened
Using netcube sample as a base, I added a child entity to the Cube, updated the component list, and generated the snapshot code. When I entered playmode, the editor crashed. This seems to happen when any child entity of an instantiated ghost is sending/receiving snapshots.
How we can reproduce it using the example you attached
Make sure the Netcube scene is loaded.
Enter playmode.
Case 1265378 .
I probably have the same issue since moving away from 2020.1.b10 to any higher version. Hard crash, and the editor.log contains this:
Obtained 256 stack frames.
#0 0x00000100000000 in (Unknown)
#1 0x0000018503a883 in Unity.NetCode.GhostSendSystem`1/SerializeJob<NetworkGhostSerializerCollection>:Execute () {0x7f9a8da4a400} + 0x783 (0x18503a100 0x18503e62b) [0x139e42960 - Unity Child Domain]
#2 0x000001850394fb in Unity.Jobs.IJobExtensions/JobStruct`1<Unity.NetCode.GhostSendSystem`1/SerializeJob<NetworkGhostSerializerCollection>>:Execute (Unity.NetCode.GhostSendSystem`1/SerializeJob<NetworkGhostSerializerCollection>&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int) {0x7f9a8ffecde0} + 0x1b (0x1850394e0 0x185039500) [0x139e42960 - Unity Child Domain]
#3 0x00000000000000 in (Unknown)
... (252 entries removed)
#2550x007f9b24a7e878 in (Unknown)
Seems like this is related to the NativeDisableContainerSafetyRestriction bug that is described here:
OK i repoed this from your project, and I know what the issue is and I also have a workaround for you.
So the issue is the same as the issue discussed over here: https://discussions.unity.com/t/800434/10
Basically NativeDisableContainerSafetyRestriction is broken. It seems to invalidate any field before it filling it with garbage.
For your case this is an easy fix, just replace them all with NativeDisableParallelForRestriction and your code works fine.
Changing NativeDisableContainerSafetyRestriction on the GhostSerializer fields to NativeDisableParallelForRestriction fixes it for me
3 Likes
Thank you so much, again! This fixes it for me as well. What a bug.
2 Likes