Game.Prefabs.ZoneBuiltRequirementData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Component data used by zone prefabs to declare build requirements that must be satisfied for a zone/prefab to be considered valid or to be allowed to be placed. It encodes references to required theme or zone entities, numeric thresholds (minimum contiguous squares, minimum instances), an area classification (AreaType), and a minimum level. This struct is intended to be used as an ECS component (IComponentData) and as a query-type parameter (IQueryTypeParameter) in Unity's DOTS patterns.
Fields
-
public Entity m_RequiredTheme
Entity reference to a required theme prefab or theme-defining entity. If set, the presence (or applicability) of this theme is required for the zone/prefab to be built. -
public Entity m_RequiredZone
Entity reference to a required zone prefab. If set, this requirement enforces that the specified zone type must exist or be adjacent / present according to the prefab logic. -
public int m_MinimumSquares
Minimum number of contiguous squares (tiles) required for the zone/prefab to be valid. Used to enforce size constraints. -
public int m_MinimumCount
Minimum count of occurrences required (for example, minimum number of instances of a given zone nearby or in total). -
public AreaType m_RequiredType
AreaType enum value describing the required area classification (e.g., Residential, Commercial, Industrial, etc.). Specifies the area type that must be present/used for this requirement. -
public byte m_MinimumLevel
Minimum level (as a small integer) required for the zone/prefab. Often used to require a certain progression or upgrade level.
Properties
- None.
This struct exposes only public fields and does not provide properties.
Constructors
public ZoneBuiltRequirementData()
This is a plain value-type (struct) with the default parameterless constructor. All fields default to their type defaults (Entity default is Entity.Null, ints to 0, enum to its default value, byte to 0). Initialize fields explicitly when creating an instance.
Methods
- None.
This type is a data-only component; no methods are defined on it.
Usage Example
// Example: creating and attaching a build requirement to a prefab entity
var requirement = new ZoneBuiltRequirementData {
m_RequiredTheme = themeEntity, // Entity representing the required theme (or Entity.Null)
m_RequiredZone = requiredZoneEntity, // Entity of required zone type (or Entity.Null)
m_MinimumSquares = 4, // Require at least a 4-square area
m_MinimumCount = 1, // At least one occurrence
m_RequiredType = AreaType.Residential, // Require residential area type
m_MinimumLevel = 1 // Minimum level 1
};
entityManager.AddComponentData(prefabEntity, requirement);
{{ This struct is primarily used inside prefab definitions to express placement/building constraints. When authoring or debugging modded prefabs, ensure referenced Entities (m_RequiredTheme / m_RequiredZone) are valid prefab entities and that AreaType values match the game's area classification enums. Since this is an IComponentData, it can be queried and processed in systems that enforce placement rules during building/validation. }}