Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug PrespawnGhost: Overflow writing data to dynamic snapshot memory buffer

Discussion in 'DOTS NetCode' started by Lukas_Kastern, Mar 23, 2022.

  1. Lukas_Kastern


    Aug 31, 2018
    Having a prespawned ghost that only serializes the following component will throw 'Overflow writing data to dynamic snapshot memory buffer' during the PrespawnGhostSerializer job.

    Code (CSharp):
    1. [GenerateAuthoringComponent]
    2. public struct ThisComponentThrowsWhenUsedOnAPreSpawnGhost : IComponentData
    3. {
    4.     [GhostField]
    5.     public float TestFieldSynced;
    7.     public float4 TestFieldNonSynced;
    8.     public float4 SecondTestFieldNonSynced;
    9. }
    This seems to be caused by the CopyComponentToSnapshot method passing the ComponentSize to the CheckValidSnapshotOffset method instead of the SnapshotSize.
    Changing line 67 in GhostSerializationHelper.cs to the following fixed the issue for me:
    Code (CSharp):
    1. CheckValidSnapshotOffset(serializer.SnapshotSize);
  2. timjohansson


    Unity Technologies

    Jul 13, 2016
    Thanks for reporting it, serializer.SnapshotSize is the correct value to use for that check
    Lukas_Kastern likes this.