Skip to content

Game.Areas.Clip

Assembly: Assembly-CSharp
Namespace: Game.Areas

Type: struct

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary: A lightweight "tag" (marker) component used by the game's ECS to mark entities related to area clipping. The type is an empty value-type with an explicit layout attribute (StructLayout(LayoutKind.Sequential, Size = 1)) to guarantee a non-zero size for serialization and interop. Implementing IComponentData makes it a standard ECS component, IQueryTypeParameter allows it to be used directly in queries/type parameters, and IEmptySerializable signals the serializer that this is an intentionally empty type with special handling.


Fields

  • No instance fields
    This struct declares no instance fields. The StructLayout(Size = 1) attribute ensures the type occupies at least one byte so it can be serialized and stored in component arrays even though it carries no data.

Properties

  • No properties
    This marker component contains no properties. It is used purely as a tag.

Constructors

  • public Clip()
    The default parameterless constructor exists implicitly because this is a value type (struct). There are no custom constructors defined.

Methods

  • No methods
    There are no methods implemented on this type. Any behavior is provided externally by systems that query for this tag component.

Usage Example

// Add the Clip tag to an entity (EntityManager API)
entityManager.AddComponentData(someEntity, new Game.Areas.Clip());

// Remove the Clip tag
entityManager.RemoveComponent<Game.Areas.Clip>(someEntity);

// Create a query that selects entities with the Clip tag
var query = entityManager.CreateEntityQuery(typeof(Game.Areas.Clip));

// Using Systems / Entities ForEach to operate on entities that have the tag
Entities
    .WithAll<Game.Areas.Clip>()
    .ForEach((Entity e /*, other component refs */) =>
    {
        // perform logic on clipped-area entities
    })
    .Run();

Notes: - Because Clip is an empty/tag component, it is typically used purely for selection and routing inside ECS systems (i.e., "this entity belongs to a clip area"). - The StructLayout(Size = 1) and IEmptySerializable combination is a common pattern to ensure empty components are handled safely by the game's serialization and storage systems.