Game.Pathfind.CoverageElement
Assembly:
Game (assembly containing the game's runtime pathfinding types)
Namespace:
Game.Pathfind
Type:
struct
Base:
IBufferElementData, IEmptySerializable
Summary:
CoverageElement is a small ECS buffer element used by the game's pathfinding/coverage systems. It holds a reference to an edge entity and a two-component cost value (float2). The type is marked with InternalBufferCapacity(0) so buffer storage is variable-length and not inlined into the entity chunk. IEmptySerializable indicates the type participates in the game's/custom serialization pipeline.
Fields
-
public Entity m_Edge
Reference to an edge entity within the pathfinding graph. Used to associate the coverage/cost information with a specific graph edge. -
public float2 m_Cost
A two-component cost vector (Unity.Mathematics.float2). Stores cost-related data associated with the edge. The exact semantic meaning of each component is defined by the pathfinding/coverage system that writes/reads this buffer element (for example: primary/secondary costs, forward/reverse costs, etc.).
Additional notes about fields:
- Because CoverageElement implements IBufferElementData it is intended to be stored in a DynamicBuffer
Properties
- This struct exposes no properties. It provides two public fields and is intended as a POD (plain-old-data) buffer element.
Constructors
public CoverageElement()
(implicit default)
As a value type (struct) CoverageElement has an implicit parameterless constructor that initializes m_Edge to Entity.Null and m_Cost to float2(0f, 0f) if default-initialized. No custom constructors are defined in the source.
Methods
- This type defines no methods. It is a pure data container used with Unity's ECS/DynamicBuffer systems and the game's serialization.
Usage Example
// Example: add coverage elements to an entity's buffer inside a SystemBase or similar system.
// Using EntityManager in a system context:
Entity entity = /* some entity that has a buffer for CoverageElement */;
var buffer = EntityManager.GetBuffer<CoverageElement>(entity);
// Add a coverage element (edgeEntity and cost must be provided by your logic)
Entity edgeEntity = /* edge entity reference */;
float2 cost = new float2(1.5f, 0.0f); // interpretation of components is system-specific
buffer.Add(new CoverageElement {
m_Edge = edgeEntity,
m_Cost = cost
});
// Reading:
for (int i = 0; i < buffer.Length; i++) {
CoverageElement elem = buffer[i];
Entity e = elem.m_Edge;
float2 c = elem.m_Cost;
// process...
}
{{ This struct is intended for use within the game's ECS-based pathfinding/coverage subsystems. Keep in mind that m_Cost is a generic float2 — check the calling/consuming systems in the game's codebase or mod code to understand the exact meaning of each component before interpreting or modifying them. When serializing or copying buffers, IEmptySerializable and the game's serialization conventions should be respected to ensure data round-trips correctly. }}