Game.Prefabs.DevTreeNodeData
Assembly:
Likely Assembly-CSharp (game assembly) — the exact assembly depends on the build/mod packaging.
Namespace:
Game.Prefabs
Type:
struct (IComponentData, IQueryTypeParameter)
Base:
Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
DevTreeNodeData is a lightweight ECS component used to represent a developer/tooling "tree" node or a prefab-selection entry in the game's data. It stores a numeric cost and a reference to an Entity that represents the associated service/prefab. This component is intended for use with Unity DOTS (Entities) systems and queries to associate UI or developer menu entries with in-game service entities and their cost.
Fields
-
public int m_Cost
Stores the cost value for this tree node (e.g., build/purchase cost). Use integer currency units consistent with the game's economy system. -
public Entity m_Service
Entity reference to the service or prefab associated with this node. This Entity typically points to a service definition or prefab entity used when spawning or inspecting that service.
Properties
- This type does not define any C# properties. It exposes plain public fields as is typical for ECS IComponentData structs.
Constructors
- Implicit default constructor (public)
As a C# struct, DevTreeNodeData has a generated default constructor. Initialize values using an object initializer or by assigning fields after creation: var node = new DevTreeNodeData { m_Cost = 500, m_Service = myServiceEntity };
Methods
- This struct does not declare any methods. It is a pure data container for ECS.
Usage Example
// Example: creating and assigning the component to an entity via EntityManager
Entity devTreeEntry = entityManager.CreateEntity();
Entity serviceEntity = /* obtain or create service entity */;
var node = new DevTreeNodeData
{
m_Cost = 1200,
m_Service = serviceEntity
};
entityManager.AddComponentData(devTreeEntry, node);
// Example within a SystemBase to read or modify entries
protected override void OnUpdate()
{
Entities.ForEach((ref DevTreeNodeData node) =>
{
// Example: reduce cost for a debugging/cheat mode
if (DebugModeEnabled)
{
node.m_Cost = Math.Max(0, node.m_Cost - 100);
}
// Use node.m_Service to look up further data or spawn the service
}).Run();
}