Game.Routes.CurveSource
Assembly:
Game (assembly containing Game.Routes)
Namespace: Game.Routes
Type:
public struct
Base:
Unity.Entities.IBufferElementData
Summary:
CurveSource is a DOTS/ECS buffer element used to store references to "curve source" entities and an associated float2 range. It's intended to be stored in a dynamic buffer on an entity (DynamicBuffer
Fields
-
public Entity m_Entity
Holds an Entity reference for the curve source. Typically this is the entity that contains the curve data or component that this entry refers to. -
public float2 m_Range
A float2 describing a range related to the curve source. Common uses are storing start/end parameters (for example normalized 0..1 parameter range along the curve) or any two-value interval associated with the source. The precise semantics depend on the consuming systems.
Properties
- None
Constructors
- Implicit default constructor (value type)
No explicit constructors are declared. Use the default struct initialization or object initializer syntax to create instances.
Methods
- None
Usage Example
// Example: adding and using a CurveSource buffer on an entity within a SystemBase
public partial class CurveSourceExampleSystem : SystemBase
{
protected override void OnCreate()
{
base.OnCreate();
// create or get entities as needed
}
protected override void OnUpdate()
{
var em = EntityManager;
// Example: add a CurveSource buffer to an entity and populate it
Entity someEntity = /* obtain or create an entity */;
Entity curveEntity = /* entity that represents a curve source */;
// Ensure the buffer exists
if (!em.HasComponent<CurveSource>(someEntity))
{
em.AddBuffer<CurveSource>(someEntity);
}
var buffer = em.GetBuffer<CurveSource>(someEntity);
buffer.Add(new CurveSource
{
m_Entity = curveEntity,
m_Range = new Unity.Mathematics.float2(0f, 1f)
});
// Example: iterate buffers in a query
Entities
.WithName("ProcessCurveSources")
.ForEach((Entity e, DynamicBuffer<CurveSource> curveSources) =>
{
for (int i = 0; i < curveSources.Length; i++)
{
var entry = curveSources[i];
// access entry.m_Entity and entry.m_Range
}
}).Schedule();
}
}
Notes: - Requires the Unity.Entities package and Unity.Mathematics for float2. - [InternalBufferCapacity(0)] means the buffer will not reserve inline storage on the entity; the buffer elements are stored in a separate heap allocation. This is useful when buffers can be large or variable in size.