Game.Objects.Object
Assembly: Game (Assembly-CSharp.dll in most Unity/Cities: Skylines 2 builds)
Namespace: Game.Objects
Type: struct
Base: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
A marker/tag ECS component used by the game to identify or mark entities that represent in-game "objects". The struct is empty by design and annotated with StructLayout(LayoutKind.Sequential, Size = 1) so it occupies exactly one byte. It implements IComponentData to be used as a Unity ECS component, IQueryTypeParameter to be usable in query APIs, and IEmptySerializable to support the game's/custom serialization path (Colossal.Serialization.Entities). This type is intended as a zero-information marker rather than carrying any data.
Fields
No fields
This struct contains no managed fields. The explicit layout and Size = 1 attribute ensures it has a non-zero size for native containers and serialization purposes.
Properties
No properties
There are no properties defined on this type.
Constructors
public Object()
Structs have an implicit default parameterless constructor; no explicit constructors are defined here. The [StructLayout(..., Size = 1)] attribute still forces the runtime/interop memory footprint to one byte.
Methods
No methods
There are no methods implemented on this struct. It functions purely as an empty/tag component.
Usage Example
// Mark an entity with the tag component
var entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new Game.Objects.Object());
// Query entities that have the tag
Entities
.WithAll<Game.Objects.Object>()
.ForEach((Entity e) =>
{
// process objects marked by the tag
})
.Schedule();
// Check if an entity has the tag
bool hasTag = entityManager.HasComponent<Game.Objects.Object>(entity);
Additional notes: - The type name "Object" can conflict with System.Object or other types named Object. When ambiguity arises, reference it with its full namespace (e.g., Game.Objects.Object) or use an alias to avoid collisions. - The StructLayout(Size = 1) is important: some ECS/native containers and custom serialization code expect non-zero-sized components. Removing or changing this may affect memory layout and serialization compatibility. - IEmptySerializable indicates the type is treated specially by Colossal's serialization utilities — it's an empty component that still participates in serialization metadata. - Because it carries no data, this component is efficient to use as a tag to drive behavior, filters, or grouping in systems.