Skip to content

Game.Common.Overridden

Assembly: Assembly-CSharp
Namespace: Game.Common

Type: struct

Base: System.ValueType, implements IComponentData, IQueryTypeParameter, IEmptySerializable

Summary: Overridden is an empty/tag ECS component used as a marker on entities. The struct is intentionally empty and compact (annotated with StructLayout(LayoutKind.Sequential, Size = 1)) so it can be attached as a lightweight tag to entities without carrying any payload. It implements: - IComponentData — so it can be used as a Unity.Entities component, - IQueryTypeParameter — allowing use in query/type parameter contexts, - IEmptySerializable — enabling Colossal's serialization pipeline to handle this empty component type correctly.

This pattern is common for "flag" or "tag" components that indicate state (for example: an entity's data was overridden, a one-shot marker, or a category label) without allocating extra memory for component data.

Fields

  • This type defines no instance fields. Overridden is an empty struct; the StructLayout attribute forces a 1-byte size so it behaves as a minimal tag both in memory and during serialization.

Properties

  • This type defines no properties. Being a pure marker component, there are no properties to read or modify — presence/absence of the component on an entity is the intended indicator.

Constructors

  • public Overridden() Structs have an implicit public parameterless constructor. Since there is no payload, construction simply yields the empty/tag value used when adding the component to an entity.

Methods

  • This type defines no instance methods. All implemented interfaces are marker-style: there are no runtime methods to invoke on this type. Behavior is driven by the ECS systems and queries that check for presence of the component.

Usage Example

// Add the tag to an entity using EntityManager:
entityManager.AddComponent<Overridden>(someEntity);

// Or, when you need to remove the tag:
entityManager.RemoveComponent<Overridden>(someEntity);

// Querying entities that have the Overridden marker in a SystemBase:
public partial class ExampleSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .WithAll<Overridden>()
            .ForEach((Entity entity, in SomeOtherComponent soc) =>
            {
                // Process entities that are marked as Overridden
            })
            .Schedule();
    }
}

Notes: - Use this component as a lightweight flag in your ECS workflows. - The IEmptySerializable implementation makes it compatible with Colossal.Serialization tooling; the 1-byte layout is deliberate to keep component storage compact.