Skip to content

Game.Tools.Temp

Assembly:
Assembly-CSharp (game runtime assembly)

Namespace:
Game.Tools

Type:
public struct

Base:
System.ValueType

Summary:
Temp is a small value-type component intended for short-lived/transient use within ECS systems. It implements IComponentData so it can be attached to Entities, and IQueryTypeParameter so it can be used as a query parameter in DOTS-style queries. It stores a reference to an "original" entity plus a few numeric fields and flags for temporary state (for example during construction, placement, or intermediate computations).


Fields

  • public Entity m_Original
    Reference to another entity considered the "original" or source for this temporary record. Typically used to link this temporary data back to an existing entity (for example, a prototype or source object).

  • public float m_CurvePosition
    A float holding a curve position or interpolation parameter. Defaults to 0f when constructed via the provided constructor. Use for progress/position along a curve or animation state.

  • public int m_Value
    An integer value for arbitrary use by systems that employ this Temp component (e.g., counters, indices, or temporary scores). Defaults to 0 in the provided constructor.

  • public int m_Cost
    An integer representing cost or weight associated with the temporary item. Defaults to 0 in the provided constructor.

  • public TempFlags m_Flags
    Flags describing state bits for this temporary item. The TempFlags enum/type controls boolean-like state stored compactly; it is provided externally and used here to influence system logic.

Properties

  • This type defines no properties. All data is stored in public fields.

Constructors

  • public Temp(Entity original, TempFlags flags)
    Creates a Temp instance referencing original and initializing flags. The numeric fields are set to safe defaults: m_CurvePosition = 0f, m_Value = 0, m_Cost = 0. Use this constructor when attaching a Temp component to an entity to ensure flags and original are initialized.

Methods

  • This type defines no methods. As a struct it has the implicit default constructor as well as the explicit constructor above.

Usage Example

// Example: attaching a Temp component to an entity using EntityManager
var temp = new Temp(originalEntity, TempFlags.None)
{
    m_CurvePosition = 0f,
    m_Value = 0,
    m_Cost = 0
};

// Using an EntityManager (synchronous)
entityManager.AddComponentData(targetEntity, temp);

// Or using an EntityCommandBuffer inside a system for safe structural changes
ecb.AddComponent(targetEntity, temp);

// Querying entities that have Temp:
Entities.ForEach((ref Temp t) =>
{
    // read/update temp fields directly
    t.m_CurvePosition += deltaTime;
    if (t.m_CurvePosition > 1f) { /* handle completion */ }
}).Schedule();

Notes: - As a value type component, Temp is cheap to copy but changes should be written back to the component storage (e.g., via AddComponentData/SetComponentData or by ref in a job). - Because it implements IQueryTypeParameter, it can be used directly in query APIs that accept query-type parameters. Adjust usage to the ECS/DOTS patterns used in your project.