Skip to content

Game.Prefabs.UITagPrefabData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

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

Summary:
UITagPrefabData is an empty "tag" component used to mark entities (typically prefab instances) that represent UI-related prefabs. The struct is explicitly given a sequential layout with Size = 1 to ensure it occupies a single byte in memory (avoiding a true zero-sized type), which can be important for compatibility with certain ECS/Jobs/Burst expectations and to ensure predictable memory layout and archetype behavior.


Fields

  • (none)
    This component contains no data fields by design. It's intended solely as a marker/tag.

Properties

  • (none)
    No runtime properties are exposed; use the presence/absence of the component for tagging.

Constructors

  • (default)
    No explicit constructors are defined. The implicit parameterless struct constructor is used when adding this component (e.g., new UITagPrefabData()).

Methods

  • (none)
    No methods are defined on this type. It only implements IComponentData and IQueryTypeParameter as marker interfaces for ECS usage.

Usage Example

// Add the tag component to an entity
var entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new UITagPrefabData());

// Create a query that selects entities with the UI tag
var uiQuery = entityManager.CreateEntityQuery(typeof(UITagPrefabData));

// In a SystemBase, filter by the tag
Entities
    .WithAll<UITagPrefabData>()
    .ForEach((Entity e, in SomeOtherDataType data) =>
    {
        // handle UI-prefab entity
    })
    .Schedule();

Additional notes: - Because this is a marker component, systems typically check for its presence (WithAll / CreateEntityQuery / HasComponent) rather than reading data from it. - The explicit StructLayout(Size = 1) prevents the struct from being treated as a zero-sized type; this can be important when relying on predictable memory and archetype behavior in ECS-based code.