Skip to content

Game.Rendering.BoneHistory

Assembly: Assembly-CSharp
Namespace: Game.Rendering

Type: struct

Base: System.ValueType, Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.IEmptySerializable

Summary:
Represents a single bone transform stored as a 4x4 matrix for use with Unity.Entities dynamic buffers. Marked with [InternalBufferCapacity(0)], meaning the buffer has no inline capacity and will use external storage for elements. This struct is used by rendering/animation systems to store per-bone matrices (e.g., previous-frame or sampled transforms) for entities, typically as a DynamicBuffer to support GPU skinning or skeletal animation data exchange between systems.


Fields

  • public Unity.Mathematics.float4x4 m_Matrix
    Holds the bone transform as a 4x4 matrix (row-major float4x4 from Unity.Mathematics). The value is typically a local or skinning transformation used by rendering/animation code.

Properties

  • This type has no properties.

Constructors

  • public BoneHistory()
    Default value-type constructor (zero-initializes m_Matrix). You can create instances with an object initializer to set m_Matrix to a desired transform (for example, float4x4.identity).

Methods

  • This type declares no methods. It implements IBufferElementData to be used as a dynamic buffer element and IEmptySerializable as a marker used by Colossal.Serialization (Cities: Skylines 2) for serialization purposes.

Notes and Considerations

  • Attribute [InternalBufferCapacity(0)] indicates the buffer has zero inline capacity — all elements are stored out-of-line. This can affect memory layout and should be considered if you expect many small buffers.
  • Use as a DynamicBuffer on an entity to store per-bone matrices. Typical uses: skinning matrices, bone history for motion blur, or sampling previous animation frames.
  • Requires Unity.Entities and Unity.Mathematics; serialization marker comes from Colossal.Serialization.Entities, which is part of the game’s custom serialization stack.
  • Keep the matrix in the expected coordinate space (local vs world) according to the consumer system (renderer or skinning shader).

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Rendering;

// somewhere in a system or initialization code
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();

// add a dynamic buffer of BoneHistory to an entity
entityManager.AddBuffer<BoneHistory>(entity);

// get the buffer and add a bone matrix
DynamicBuffer<BoneHistory> bones = entityManager.GetBuffer<BoneHistory>(entity);
bones.Add(new BoneHistory { m_Matrix = float4x4.identity });

// update an existing element
if (bones.Length > 0)
{
    bones[0] = new BoneHistory { m_Matrix = float4x4.TRS(new float3(0,1,0), quaternion.identity, new float3(1f)) };
}