Skip to content

Game.PowerLineData

Assembly: Assembly-CSharp (typical for game code / mods)
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType (struct)
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable

Summary:
PowerLineData is an empty marker component used by the game's ECS to tag entities/prefabs representing power lines. The struct is explicitly sized with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure it has a non-zero size for interop/serialization purposes and to avoid issues with truly empty structs. Implementing IComponentData makes it usable as a component in Unity.Entities, IQueryTypeParameter allows it to be used in query type parameters, and IEmptySerializable ensures compatibility with the game's (Colossal) serialization system.


Fields

  • This struct contains no fields.
    The StructLayout(Size = 1) attribute ensures the struct occupies one byte even though it has no managed fields. This is intentional to support serialization and native interop requirements.

Properties

  • This struct declares no properties.

Constructors

  • public PowerLineData() (implicit default constructor)
    As a value type, PowerLineData has an implicit parameterless constructor that initializes the (empty) instance. No custom constructors are defined.

Methods

  • This struct declares no methods.

Usage Example

using Unity.Entities;
using Game.Prefabs;

// Create an entity that represents a power line (marker component)
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = em.CreateArchetype(typeof(PowerLineData));
Entity powerLineEntity = em.CreateEntity(archetype);

// Or add the marker to an existing entity
em.AddComponent<PowerLineData>(someExistingEntity);

// Query for power line entities
var query = em.CreateEntityQuery(typeof(PowerLineData));
using (var entities = query.ToEntityArray(Unity.Collections.Allocator.TempJob))
{
    // process power line entities...
}

File: Game\Prefabs\PowerLineData.cs

Notes: - Because PowerLineData contains no semantic data, it is used purely as a tag/marker. Systems should rely on the presence/absence of this component rather than any stored values. - The StructLayout(Size = 1) pattern is common for empty-but-serializable marker structs to ensure stable native size and compatibility with serialization systems.