Skip to content

Game.Prefabs.PlaceholderObjectData

Assembly: Assembly-CSharp (typical Unity game assembly)
Namespace: Game.Prefabs

Type: struct

Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
A lightweight ECS component used to mark an entity as a "placeholder" prefab configuration. Carries placement requirement flags and a small option that controls whether the placement/group index should be randomized. Intended for use in the game's entity-component system to drive prefab/placeholder placement logic at runtime or during prefab spawning in editor/tools.


Fields

  • public ObjectRequirementFlags m_RequirementMask
    {{ Specifies the requirement flags that constrain where or how the placeholder object can be placed. ObjectRequirementFlags is expected to be a bitmask/enum describing placement constraints (for example: ground-only, water-only, slope restrictions, required adjacency, etc.). Default (when not set) is the enum's default value (typically 0). This field is read/written directly by systems that perform placement checks or filter candidate locations. }}

  • public bool m_RandomizeGroupIndex
    {{ When true, indicates that the group/index used to select a variation of the placeholder prefab should be randomized, producing visual variety for otherwise identical placeholders. When false, placement/prefab selection should use deterministic/grouped selection rules. Default is false. }}

Properties

  • This type does not declare any C# properties; it exposes plain public fields suitable for fast ECS access.
    {{ As a struct implementing IComponentData, it's intended to be stored directly on entities. There are no managed properties or auto-properties to access. }}

Constructors

  • public PlaceholderObjectData()
    {{ Structs in C# have an implicit parameterless constructor that initializes m_RequirementMask to its default enum value and m_RandomizeGroupIndex to false. You may also construct using an object initializer to set values explicitly. }}

Methods

  • This type does not declare any methods.
    {{ Behavior associated with this component is implemented in systems that read the component data (placement, validation, or spawn systems). The struct itself is just a data container. }}

Usage Example

// Example: create and attach the component to an entity using EntityManager
var placeholder = new PlaceholderObjectData
{
    m_RequirementMask = ObjectRequirementFlags.Ground | ObjectRequirementFlags.Flat,
    m_RandomizeGroupIndex = true
};

entityManager.AddComponentData(entity, placeholder);

// Or set via an EntityCommandBuffer in a Job/System
ecb.AddComponent(entity, new PlaceholderObjectData { m_RandomizeGroupIndex = false });

{{ NOTES: Ensure the ObjectRequirementFlags enum is referenced from the correct namespace/assembly in your mod. Systems that perform placement or prefab selection should read this component to apply placement constraints and randomization behavior. }}