Game.Rendering.Momentum
Assembly:
Game (assembly containing runtime game code; may appear in Assembly-CSharp in some builds)
Namespace: Game.Rendering
Type:
struct
Base:
IBufferElementData, IEmptySerializable
Summary:
A lightweight buffer element that holds a single floating-point momentum value for use with Unity's Entities (DOTS) dynamic buffers. Marked with InternalBufferCapacity(0) so the dynamic buffer uses heap storage (no inline fixed capacity). Implements IEmptySerializable to participate in the game's Colossal.Serialization system.
Fields
-
public float m_Momentum
Stores the momentum value. Semantic meaning (e.g., speed, impulse, or influence) depends on the calling system; units are determined by the code that produces/consumes this buffer element. -
private System.Diagnostics.Stopwatch m_Stopwatch
This type does not declare such a field; none present in this struct. (Included in template—no matching field in source.) -
private Unity.Jobs.JobHandle <producerHandle>k__BackingField
This type does not declare such a field; none present in this struct. (Included in template—no matching field in source.)
Properties
public Unity.Jobs.JobHandle producerHandle { get; private set }
No properties are defined on this struct. (Included in template—no matching property in source.)
Constructors
public EndFrameBarrier()
This is a value type (struct) with the implicit default constructor only. No explicit constructors are defined in the source.
Methods
protected virtual OnCreate() : System.Void
No methods are defined on this struct. Behavior is passive: it is a POD element stored in a DynamicBuffer.
Usage Example
// Get or add a dynamic buffer of Momentum on an entity
var buffer = entityManager.GetBuffer<Momentum>(entity);
// Add a momentum sample
buffer.Add(new Momentum { m_Momentum = 2.5f });
// Read/update
for (int i = 0; i < buffer.Length; i++)
{
var item = buffer[i];
// sample usage: scale momentum
item.m_Momentum *= 0.9f;
buffer[i] = item;
}
Notes: - The [InternalBufferCapacity(0)] attribute indicates the buffer has zero inline capacity; elements are allocated on the heap, which is appropriate for variable-length buffers but has different performance characteristics than small inline buffers. - IEmptySerializable is used by the game's serialization pipeline to mark this type as serializable without requiring custom serialization code.