Skip to content

Game.AssetStamp

Assembly: Assembly-CSharp
Namespace: Game.Objects

Type: struct

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

Summary:
AssetStamp is an empty (marker/tag) ECS component used to mark entities that represent or are associated with asset "stamps" within Cities: Skylines 2. The struct is laid out sequentially with an explicit Size = 1 via the StructLayout attribute to ensure a non-zero size and predictable memory layout for serialization and interoperability with Colossal's serialization system. Because it implements IComponentData, it can be attached to entities; IQueryTypeParameter enables its use in query helpers/filters; IEmptySerializable indicates it participates in Colossal.Serialization but contains no payload data.


Fields

  • This struct defines no instance fields.
    The only type-level attribute is:
  • [StructLayout(LayoutKind.Sequential, Size = 1)] — ensures the type has a defined layout and a size of 1 byte (useful for serialization and avoiding zero-sized type issues).

Properties

  • This type exposes no properties. It is a marker/tag component with no stored data.

Constructors

  • No explicit constructors are defined. As a value type (struct), it has the implicit default constructor that initializes the single-byte footprint to zero.

Methods

  • This type declares no methods. The implemented interfaces are marker-type interfaces for ECS/query/serialization and do not require additional members on this struct.

Usage Example

// Example: add AssetStamp to an entity using EntityManager
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity someEntity = ...; // obtained or created elsewhere

// Option A: add the tag component instance
entityManager.AddComponentData(someEntity, new Game.Objects.AssetStamp());

// Option B: add the component type (when available in your ECS version)
entityManager.AddComponent<Game.Objects.AssetStamp>(someEntity);

// Querying entities that have the tag:
// (Using an ECS System or SystemBase)
Entities
    .WithAll<Game.Objects.AssetStamp>()
    .ForEach((Entity entity, in SomeOtherComponent comp) =>
    {
        // Process entities that are asset stamps
    })
    .Schedule();

Additional notes: - Because AssetStamp contains no payload, it is intended solely for filtering/identification in queries or systems. - The StructLayout(Size = 1) avoids issues with truly zero-sized structs when serialized or when interacting with native code/serialization pipelines.