Skip to content

Game.Prefabs.DevTreeNodeRequirement

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
Represents a single requirement entry for a development/tree node in the game's DOTS ECS. This struct is a buffer element (IBufferElementData) that stores an Entity reference (m_Node) pointing to another node that is required. Use as elements of a DynamicBuffer on an entity that represents a dev-tree node to model prerequisite relationships.


Fields

  • public Unity.Entities.Entity m_Node
    Stores the Entity reference for the required dev-tree node. As a plain Entity field, this is blittable and suitable for use in burst-compiled jobs and ECS buffers.

Properties

  • (none)

Constructors

  • public DevTreeNodeRequirement()
    Implicit default struct constructor provided by C#. You can also create instances with object initializer syntax: new DevTreeNodeRequirement { m_Node = someEntity };

Methods

  • (none)

Usage Example

using Unity.Entities;
using Game.Prefabs;

// Add a requirement to an entity (e.g., inside a SystemBase)
protected override void OnUpdate()
{
    // Example: add a requirement to 'targetEntity' that points to 'requiredNodeEntity'
    Entity targetEntity = /* obtain or create entity */;
    Entity requiredNodeEntity = /* obtain required node entity */;

    // Ensure the buffer exists, then add the requirement
    var buffer = EntityManager.HasComponent<DevTreeNodeRequirement>(targetEntity)
        ? EntityManager.GetBuffer<DevTreeNodeRequirement>(targetEntity)
        : EntityManager.AddBuffer<DevTreeNodeRequirement>(targetEntity);

    buffer.Add(new DevTreeNodeRequirement { m_Node = requiredNodeEntity });
}