Skip to content

Game.QuantityObjectData

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

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
QuantityObjectData is an ECS component used by the game's entity systems to store quantity-related data for a prefab. It holds a Resource descriptor, an associated MapFeature, and a step mask bitfield used to control which simulation/update steps apply to this object. This struct is a plain data container (no behavior) and can be queried in Jobs/Systems because it implements IComponentData and IQueryTypeParameter.


Fields

  • public Resource m_Resources
    Holds the resource descriptor(s) associated with this prefab instance. The concrete Resource type (from Game.Economy) typically encodes what resource(s) are produced, consumed, or stored by the object.

  • public MapFeature m_MapFeature
    References a map feature identifier/detail (from Game.Areas) that categorizes or links this prefab to a map feature (for example, to affect terrain, placement rules, visuals, or interactions tied to map features).

  • public uint m_StepMask
    A bitmask representing which simulation/update steps (or phases) this object participates in. Each bit corresponds to a simulation step; systems can test or modify this mask to enable/disable behavior per-step.

Properties

  • None. This type exposes only public fields and defines no properties.

Constructors

  • public QuantityObjectData()
    No explicit constructors are defined in the source; the default parameterless constructor (value-type default) is used. Initialize fields explicitly when creating or setting the component.

Methods

  • None. This struct contains no methods — it is pure data for use by ECS systems and jobs.

Usage Example

// Example: create an entity with the component (EntityManager API)
var entity = entityManager.CreateEntity(typeof(QuantityObjectData));
entityManager.SetComponentData(entity, new QuantityObjectData
{
    m_Resources = someResource,     // Resource instance from Game.Economy
    m_MapFeature = someMapFeature,  // MapFeature value from Game.Areas
    m_StepMask = 1u << 2            // enable/mark step index 2
});

// Example: modify in a System using Entities.ForEach
Entities
    .ForEach((ref QuantityObjectData q) =>
    {
        // enable step 0
        q.m_StepMask |= 1u;
        // adjust resources or feature as needed
    })
    .Schedule();