Skip to content

Game.Prefabs.NetGeometryNodeState

Assembly:
Assembly-CSharp.dll

Namespace:
Game.Prefabs

Type:
struct

Base:
Unity.Entities.IBufferElementData

Summary:
A buffer element type used by the ECS to store node-related geometry matching/state information for network pieces. Marked with InternalBufferCapacity(0) so the dynamic buffer starts with no preallocated storage. The fields represent composition flags and match/type information used when determining how node geometry should be applied or matched against edges. This struct is intended to be stored in a DynamicBuffer on an entity.


Fields

  • public CompositionFlags m_CompositionAll
    Flags that must all be present for a match (logical AND). Used to require a set of composition conditions to be true.

  • public CompositionFlags m_CompositionAny
    Flags where at least one must be present for a match (logical OR). Used to allow alternative composition conditions.

  • public CompositionFlags m_CompositionNone
    Flags that must not be present for a match (logical NOT). Used to exclude nodes with specific composition flags.

  • public CompositionFlags m_State
    The state flags representing the current/target state of the node geometry. Typically used to record or test the node's configuration.

  • public NetEdgeMatchType m_MatchType
    Specifies how edges are matched to this node (match mode/type). Controls matching behavior between node geometry and edge geometry.

Note: The exact semantics of CompositionFlags and NetEdgeMatchType are defined by their respective enum/type declarations elsewhere in the codebase. They typically represent bitflags (for CompositionFlags) and an enum discriminant (for NetEdgeMatchType).

Properties

  • This type exposes no C# properties. It is a plain buffer element struct with public fields.

Constructors

  • public NetGeometryNodeState()
    Structs in C# have an implicit parameterless constructor that initializes all fields to their default values (typically zero/null). No explicit constructors are defined in the source.

Methods

  • This type defines no methods. It is a POD (plain-old-data) buffer element used by Unity's ECS.

Usage Example

using Unity.Entities;

// Example system code demonstrating how to add and populate the dynamic buffer.
public partial class ExampleSystem : SystemBase
{
    protected override void OnCreate()
    {
        base.OnCreate();
    }

    protected override void OnUpdate()
    {
        Entities.ForEach((Entity entity, int entityInQueryIndex) =>
        {
            // Ensure the entity has a dynamic buffer for NetGeometryNodeState
            var buffer = EntityManager.GetBuffer<NetGeometryNodeState>(entity);

            // Clear existing entries
            buffer.Clear();

            // Create and add a new element (replace flag names with actual enum values)
            NetGeometryNodeState entry = new NetGeometryNodeState
            {
                m_CompositionAll = CompositionFlags.None,   // example placeholder
                m_CompositionAny = CompositionFlags.None,   // example placeholder
                m_CompositionNone = CompositionFlags.None,  // example placeholder
                m_State = CompositionFlags.None,            // example placeholder
                m_MatchType = NetEdgeMatchType.Default      // example placeholder
            };

            buffer.Add(entry);

        }).WithoutBurst().Run(); // adjust scheduling as appropriate
    }
}

Notes: - The [InternalBufferCapacity(0)] attribute means the dynamic buffer starts with no inline capacity; elements will be stored in heap-allocated memory when added. - Use the actual CompositionFlags and NetEdgeMatchType enum values from the codebase when populating fields. - Because this is an IBufferElementData, it is intended to be used via DynamicBuffer APIs (GetBuffer/AddBuffer, etc.).