Game.Objects.Static
Assembly: Game (runtime may be part of Assembly-CSharp)
Namespace: Game.Objects
Type: struct
Base: System.ValueType
Summary:
Lightweight empty/tag component used by the game's ECS. The struct implements Unity.Entities.IComponentData (so it can be attached to entities), IQueryTypeParameter (so it can be used in query type parameters), and Colossal.Serialization.Entities.IEmptySerializable (so it participates in the game's serialization system for empty components). The StructLayout attribute with Size = 1 ensures the type has a non-zero size for serialization/interop reasons despite being empty. Typical usage is as a marker to mark an entity as "static" (or any other semantic chosen by the game/mod), not to store data.
Fields
- This struct declares no instance fields. It is an empty marker/tag component. The StructLayout(LayoutKind.Sequential, Size = 1) attribute ensures a 1-byte layout for serialization compatibility.
Properties
- This type declares no properties. It is used purely as a marker component.
Constructors
public Static()
The parameterless constructor is the implicit default. No initialization is required because the type has no state.
Methods
- This type does not declare any methods. It functions as a plain marker component for ECS queries and for the game's serialization system via IEmptySerializable.
Usage Example
// Add a Static tag to a newly created entity
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = em.CreateEntity();
em.AddComponentData(entity, new Game.Objects.Static());
// Query for entities that have the Static marker
var query = em.CreateEntityQuery(ComponentType.ReadOnly<Game.Objects.Static>());
// Or in a SystemBase:
// Entities.WithAll<Game.Objects.Static>().ForEach((Entity e) => { /* process static entities */ }).Schedule();