Skip to content

Game.RestPoseElement

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
Represents a single rest-pose transform element intended to be stored in a dynamic buffer on an entity. Contains a position (float3) and rotation (quaternion). The type is annotated with [InternalBufferCapacity(0)], meaning the default internal capacity is zero (no preallocated elements) to minimize memory usage until elements are added.


Fields

  • public Unity.Mathematics.float3 m_Position
    Position of the rest pose in local (or specified) space. Uses Unity.Mathematics.float3 for efficient SIMD-friendly storage.

  • public Unity.Mathematics.quaternion m_Rotation
    Rotation of the rest pose. Uses Unity.Mathematics.quaternion for compact quaternion representation.

Properties

  • This type has no properties. It exposes two public fields and relies on the default struct behavior.

Constructors

  • public RestPoseElement()
    No explicit constructors are defined in the source — the default parameterless struct constructor (zero-initializing the fields) is used. You can initialize instances with object initializers.

Methods

  • This type defines no methods.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;

// create entity and add a RestPoseElement buffer
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var e = em.CreateEntity();

// add dynamic buffer (initial internal capacity is 0 due to attribute)
var buffer = em.AddBuffer<RestPoseElement>(e);

// add an element
buffer.Add(new RestPoseElement {
    m_Position = new float3(0f, 1.0f, 0f),
    m_Rotation = quaternion.identity
});

// update an existing element
var elem = buffer[0];
elem.m_Position = new float3(0f, 2.0f, 0f);
buffer[0] = elem;

Additional notes: - Because this is an IBufferElementData, it is used with EntityManager/AddBuffer, DynamicBuffer, and jobs that operate on DynamicBuffer. - The [InternalBufferCapacity(0)] attribute reduces initial memory overhead; if you expect many small buffers, consider tuning this value based on usage patterns.