Search Unity

Bug PrespawnGhost: Overflow writing data to dynamic snapshot memory buffer

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

  1. Lukas_Kastern

    Lukas_Kastern

    Joined:
    Aug 31, 2018
    Posts:
    97
    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;
    6.  
    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

    timjohansson

    Unity Technologies

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