Game.ProcessingRequirementData
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
ProcessingRequirementData is a small ECS component used to describe a production/processing requirement for a prefab (typically a building or production line). It identifies which resource the requirement applies to and the minimum produced amount associated with that requirement. This component is intended to be attached to entities that represent prefabs or production processes so systems can query and enforce processing rules (for example, minimum batch sizes before an output is considered valid, or thresholds to trigger shipments or further processing). It references the Game.Economy.Resource type for the resource identity.
Fields
-
public Game.Economy.Resource m_ResourceType
This field identifies the resource type affected by the requirement. The type is defined in Game.Economy.Resource. Use this to indicate which resource (goods, raw material, etc.) the minimum produced amount refers to. -
public int m_MinimumProducedAmount
The minimum amount of the specified resource that must be produced to satisfy the requirement. Systems reading this component should use this value to decide when processing completes, when to enqueue shipments, or when to allow next-stage production.
Properties
- No public properties.
This struct exposes plain public fields (m_ResourceType and m_MinimumProducedAmount) and does not declare properties.
Constructors
- Implicit parameterless constructor (generated by the C# compiler)
Because this is a struct, it has the default parameterless constructor. You can initialize it using an object initializer or by assigning fields directly:
var req = new ProcessingRequirementData { m_ResourceType = / Resource value /, m_MinimumProducedAmount = 10 };
(Optional) Create helper constructors in your own code if you prefer explicit construction.
Methods
- No methods.
This component is a plain data container with no behavior. Processing logic should be implemented in systems that query for this component.
Usage Example
using Unity.Entities;
using Game.Prefabs;
using Game.Economy;
// Example: attach the requirement to an entity (e.g. a processing building prefab)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new ProcessingRequirementData {
m_ResourceType = /* e.g. Resource.Wood or a valid Game.Economy.Resource value */,
m_MinimumProducedAmount = 20
});
Additional notes: - Because this implements IComponentData, it is safe to use in Burst-compatible ECS systems and queries. - Implementing IQueryTypeParameter makes the type usable as a compile-time query parameter in some Unity.Entities query APIs; use systems to read these values and implement processing/production logic in a central processing system. - When creating authoring inspectors or prefab data, expose these fields so modders can configure resource requirements per prefab.