Skip to content

Game.Tools.LocalCurveCache

Assembly:

Namespace: Game.Tools

Type: struct

Base: System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
LocalCurveCache is a lightweight ECS component (value type) used to store a cached Bezier4x3 curve in local space for tooling code. It is a simple container intended to be attached to entities or used in queries; the struct is blittable and suitable for use in Jobs/Entities code. The underlying Bezier4x3 type comes from Colossal.Mathematics and represents a cubic Bezier curve with four control points (each a 3D vector/float3).


Fields

  • public Bezier4x3 m_Curve
    This field holds the cached cubic Bezier curve (4 control points Ă— 3 components). Typical usage is to store the curve in local coordinates for tool processing, sampling, or rendering. Because the struct is a component, the field is a value stored directly on the entity's component data.

  • private System.Diagnostics.Stopwatch m_Stopwatch
    Not present in this type. (Included here in the template only; LocalCurveCache does not declare any stopwatch or timing fields.)

  • private Unity.Jobs.JobHandle <producerHandle>k__BackingField
    Not present in this type. (Included here in the template only; LocalCurveCache does not declare any JobHandle backing fields.)

Properties

  • This type does not declare any managed properties. It only exposes the public field m_Curve. As an IComponentData it is used directly by ECS/APIs that operate on component fields.

  • public Unity.Jobs.JobHandle producerHandle { get; private set }
    Not applicable to this type.

Constructors

  • public LocalCurveCache() (implicit default)
    No explicit constructors are defined. The default parameterless constructor is used to create an instance with default-initialized m_Curve. To set a specific curve, assign m_Curve after construction or use an object initializer.

Methods

  • This struct declares no methods. It is a pure data container and serves as a marker/value carrier for ECS queries and jobs. It implements IQueryTypeParameter purely as a marker to participate in certain query patterns.

  • protected virtual OnCreate() : System.Void
    Not applicable to this type.

Usage Example

using Colossal.Mathematics;
using Unity.Entities;
using Unity.Mathematics;

// Create and attach to an entity via EntityManager
var p0 = new float3(0, 0, 0);
var p1 = new float3(1, 0, 0);
var p2 = new float3(1, 0, 1);
var p3 = new float3(0, 0, 1);

// Construct a Bezier4x3 (constructor details depending on Colossal.Mathematics implementation)
var curve = new Bezier4x3(p0, p1, p2, p3);

var component = new LocalCurveCache { m_Curve = curve };
entityManager.AddComponentData(myEntity, component);

// Read/modify inside a SystemBase
Entities
    .ForEach((ref LocalCurveCache cache) =>
    {
        // Sample or update cache.m_Curve here
        var control0 = cache.m_Curve.p0; // example access (actual field names depend on Bezier4x3 definition)
    })
    .Schedule();

Notes and tips: - Because LocalCurveCache is a value-type component, copying occurs when assigning or passing it; update fields in-place when used in jobified code. - Be mindful of the actual Bezier4x3 API (field names, constructors and sampling methods) in Colossal.Mathematics—adjust usage accordingly. - IQueryTypeParameter is a marker interface used by some ECS query APIs in Cities: Skylines 2 codebase; no runtime behavior needs to be implemented in this struct.