Skip to content

Game.Prefabs.ObjectBuiltRequirementData

Assembly: Game (in-game assembly)
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
A small ECS component that encodes a minimum count requirement for a prefab or object. Typically used to mark an entity (prefab) with how many of a certain object must be built/available before the marked prefab becomes relevant/valid. As a plain blittable struct implementing IComponentData it is suitable for use in Entities queries and jobs and is intended for lightweight state or configuration data in the game's ECS.


Fields

  • public int m_MinimumCount
    Represents the required minimum number of objects (or instances) that must exist. This value is set on the entity and read by systems that enforce or check build requirements. Because it is a plain int it is cheap to read in jobs or queries.

Properties

  • (none)
    This component exposes only a public field; there are no C# properties.

Constructors

  • (implicit) public ObjectBuiltRequirementData()
    Structs have an implicit parameterless constructor. Initialize instances using object initializer syntax or set the field directly.

Methods

  • (none)
    No methods are defined on this component type — it purely holds data.

Usage Example

// Add the requirement to an entity (e.g. during conversion or setup)
var req = new ObjectBuiltRequirementData { m_MinimumCount = 3 };
entityManager.AddComponentData(prefabEntity, req);

// Example system reading the requirement
Entities
    .ForEach((ref ObjectBuiltRequirementData req) =>
    {
        int builtCount = /* compute or query current built count for relevant type */;
        if (builtCount >= req.m_MinimumCount)
        {
            // requirement satisfied — enable or spawn something
        }
        else
        {
            // requirement not met — disable or block something
        }
    }).Run();

Additional notes: - Because this is a simple IComponentData struct, it can be used in burst-compatible jobs and in ECS queries for high-performance checks. - Keep semantics consistent: document what “minimum count” refers to (which object type or tag) in adjacent components or authoring data so systems know which count to compare against.