Skip to content

Game.DynamicHousehold

Assembly: Assembly-CSharp (typical for game code / mods)
Namespace: Game.Prefabs

Type: struct

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

Summary:
DynamicHousehold is a marker component (an empty struct) used to tag ECS entities as representing a dynamic household within the game's data model. The StructLayout attribute with Size = 1 ensures the struct is not a zero-sized type at runtime, which makes it safe to store in native containers and to use reliably as an ECS component. As an IComponentData, it is intended to be added to entities and used in queries and systems to identify or filter household entities without carrying additional data.


Fields

  • (none)
    This struct does not declare any fields; it is intended as a pure marker component.

Properties

  • (none)
    No properties are defined.

Constructors

  • public DynamicHousehold()
    The default parameterless constructor is used (auto-generated for the struct). No custom initialization is required.

Methods

  • (none)
    There are no methods on this marker component.

Usage Example

// Add the marker to an entity via an EntityManager
entityManager.AddComponentData(householdEntity, new DynamicHousehold());

// Or from a system using an EntityCommandBuffer
ecb.AddComponent<DynamicHousehold>(householdEntity);

// Querying for entities that are dynamic households
Entities
    .WithAll<DynamicHousehold>()
    .ForEach((Entity entity) =>
    {
        // process household entity
    }).Schedule();

Additional notes: - The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute is important to avoid zero-sized type issues in native collections and ECS storage. - Because this is a marker component, systems typically only need to check for its presence/absence (WithAll, WithNone, HasComponent, etc.) rather than reading data from it.