Skip to content

Game.Prefabs.NetGeometryEdgeState

Assembly: Assembly-CSharp.dll (typical Unity game assembly)
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
Buffer element used to store per-edge geometry composition and state flags for net (road/track) prefabs. This struct is intended to be used in a DynamicBuffer on entities that represent net geometry edges. It encodes a set of CompositionFlags used for matching/composition logic (all/any/none) and the current state flags for the edge. The struct is annotated with [InternalBufferCapacity(0)] so no inline storage is reserved on the entity (the buffer will be externally allocated).


Fields

  • public CompositionFlags m_CompositionAll
    Flags that must all be present for a composition match. Use this to require that every flag in this mask is set on whatever is being tested.

  • public CompositionFlags m_CompositionAny
    Flags where any single flag being present will constitute a match. Use this to indicate alternatives — if any bit in this mask is present the condition passes.

  • public CompositionFlags m_CompositionNone
    Flags that must be absent for a composition match. This mask indicates bits that must not be set.

  • public CompositionFlags m_State
    Current state flags for this edge. Represents the active state/attributes on the edge (implementation-specific meaning depends on the CompositionFlags enum used by the net/prefab system).

Properties

  • None. (This type is a plain data struct implementing IBufferElementData.)

Constructors

  • public NetGeometryEdgeState()
    Structs have an implicit parameterless constructor that zero-initializes fields. You can also initialize the fields with an object initializer when adding to a buffer.

Methods

  • None. This type is plain data only.

Usage Example

// Add and populate a DynamicBuffer<NetGeometryEdgeState> on an entity
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = em.CreateEntity();

// Add the buffer (note: [InternalBufferCapacity(0)] so it will be externally allocated)
DynamicBuffer<NetGeometryEdgeState> buffer = em.AddBuffer<NetGeometryEdgeState>(e);

// Add an element with specific flags (CompositionFlags is a bitmask enum)
buffer.Add(new NetGeometryEdgeState {
    m_CompositionAll = CompositionFlags.None,
    m_CompositionAny = CompositionFlags.SomeFlag,
    m_CompositionNone = CompositionFlags.OtherFlag,
    m_State = CompositionFlags.Active
});

// Read/update in a system
Entities
    .ForEach((ref DynamicBuffer<NetGeometryEdgeState> edges) =>
    {
        for (int i = 0; i < edges.Length; i++)
        {
            var edge = edges[i];
            // inspect or modify edge.m_State or composition masks
            // edges[i] = edge; // write back if modified
        }
    }).Schedule();