Skip to content

Game.Objects.ObjectGeometry

Assembly:
Assembly-CSharp.dll (inferred — the source file does not specify the assembly; typical for Cities: Skylines 2 game code and mods)

Namespace: Game.Objects

Type: struct ObjectGeometry

Base: System.ValueType (struct); implements: - Unity.Entities.IComponentData - Unity.Entities.IQueryTypeParameter - Colossal.Serialization.Entities.IEmptySerializable

Summary: ObjectGeometry is an empty marker component (a minimal/marker struct) used with the Unity.Entities (ECS) framework. It carries no data but is used to tag entities that represent or contain object geometry so systems can find and operate on those entities. The struct is annotated with StructLayout(LayoutKind.Sequential, Size = 1) to ensure it has a non-zero size for interop/serialization and to satisfy runtime requirements for empty types. Implementing IEmptySerializable indicates it participates in the game's serialization pipeline despite having no payload.


Fields

  • This struct declares no instance fields. Additional info: The source applies [StructLayout(LayoutKind.Sequential, Size = 1)] which forces the struct to occupy 1 byte in memory. This avoids issues with zero-sized types in some native interop and serialization scenarios.

Properties

  • None. (No properties are defined on this type.)

Constructors

  • public ObjectGeometry() This is the default value-type constructor (implicitly provided). There are no explicit constructors declared in the source.

Methods

  • None declared. The type is a plain marker type and exposes no methods.

Usage Example

// Typical usage: adding the marker component to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var e = entityManager.CreateEntity();
entityManager.AddComponent<ObjectGeometry>(e);

// Querying entities that have the ObjectGeometry tag
Entities
    .WithAll<ObjectGeometry>()
    .ForEach((Entity entity) =>
    {
        // operate on entities that have object geometry
    })
    .Schedule();

Notes and guidance: - Because ObjectGeometry implements IQueryTypeParameter, it can be used directly in query filters (WithAll, WithNone, etc.). - Implementing IEmptySerializable / being empty means it carries no runtime data; use it solely as a tag. If you later need per-entity geometry data, introduce a separate IComponentData with fields. - The StructLayout(Size = 1) attribute is important for serialization and native interop; do not remove it unless you understand the consequences for the game's serializer and native code paths.