Game.LaneGeometry
Assembly: Assembly-CSharp
Namespace: Game.Net
Type: struct
Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary:
LaneGeometry is an empty/tag component used by the game's ECS to mark lane entities for geometry-related processing or to participate in the game's serialization pipeline. The struct is explicitly given a size of 1 byte via StructLayout(Size = 1) to avoid zero-sized-struct issues with some runtimes/serializers and to ensure it is presentable to serialization and query systems even though it contains no payload data. Implementing IQueryTypeParameter makes it convenient to use in queries/filters; implementing IEmptySerializable integrates it with the game's Colossal serialization conventions.
Fields
- This struct declares no instance fields.
{{ This is a marker (tag) component — it carries no data. The explicit StructLayout(Size = 1) forces a non-zero size for compatibility with serializers and some ECS operations. }}
Properties
- This struct has no properties.
{{ Use it purely as a tag; there are no runtime-accessible values stored on this component. }}
Constructors
public LaneGeometry()
{{ The default parameterless constructor is the compiler-provided struct constructor. No initialization is required or performed because the type contains no data. }}
Methods
- This struct declares no methods.
{{ There are no lifecycle or helper methods on this type; behavior is provided by systems that query for the presence (or absence) of the component on entities. }}
Usage Example
// Mark an entity as having lane geometry (tag the entity)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity laneEntity = /* obtain or create entity */;
entityManager.AddComponentData(laneEntity, new Game.Net.LaneGeometry());
// Query for entities with the tag in a system (EntityQuery / SystemAPI usage)
public partial struct LaneGeometrySystem : ISystem
{
public void OnUpdate(ref SystemState state)
{
// Example: iterate over entities that have LaneGeometry and another component
foreach (var (transform, entity) in SystemAPI.Query<RefRO<SomeLaneComponent>>()
.WithAll<Game.Net.LaneGeometry>()
.WithEntityAccess())
{
// process lane geometry related work here
}
}
}
{{ TIPS: - Treat this as a pure marker component; add or remove it to enable/disable certain processing on an entity. - The StructLayout(Size = 1) is intentional: it avoids issues with zero-size types in some serialization and runtime contexts. Do not change the layout unless you understand serialization and ECS implications. - Because it implements IEmptySerializable, it fits into the game's Colossal serialization system — useful if you need the presence/absence of the tag to persist across save/load. - Use WithAll< LaneGeometry > or EntityManager checks to filter systems for lane-geometry-related work. }}