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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question RigidBody struct size & layout

Discussion in 'Physics for ECS' started by Selmar, Jan 25, 2023.

  1. Selmar


    Sep 13, 2011
    Code (CSharp):
    1. /// <summary>   An instance of a collider in a physics world. </summary>
    2. /// Using StructLayout to handle for an issue where there can be a mismatch between struct sizes for RigidBody in separate jobs
    3. [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit, Pack = 1, Size = 56)]
    4. public struct RigidBody : ICollidable, IAspectQueryable
    5. {
    6.     ...
    7. }
    I found this in RigidBody.cs. It scared me a little, while at the same time piquing my curiosity.

    What could cause this kind of struct size mismatch?
    Matt-Ostgard likes this.