Game.Prefabs.MultipleUnitTrainData
Assembly:
Assembly-CSharp
Namespace:
Game.Prefabs
Type:
struct MultipleUnitTrainData
Base:
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary:
Marker/tag component used by the game's ECS/prefab systems to identify entities that represent multiple-unit trains. The struct is explicitly given a sequential layout with a Size of 1 byte to avoid empty-struct issues with certain serializers and runtime code paths (ensures a non-zero size for serialization and storage). It carries no data — it exists solely as a compact flag component and participates in queries and serialization via the implemented interfaces.
Fields
- This struct declares no instance fields.
The type is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)], reserving 1 byte so the struct is non-empty for serialization/storage despite having no logical data.
Properties
- None.
As an empty/tag component, it exposes no properties.
Constructors
public MultipleUnitTrainData()
(implicit)
Structs in C# have an implicit parameterless constructor; there are no explicit constructors defined. Use the default instance to add this tag component to entities.
Methods
- None.
Behavior is provided by the ECS and serialization systems that recognize the implemented interfaces; the type itself contains no methods.
Usage Example
// Add the tag to an entity (EntityManager API)
var tag = new MultipleUnitTrainData();
entityManager.AddComponentData(someEntity, tag);
// Use as a query filter in a SystemBase/ECS job
Entities
.WithAll<MultipleUnitTrainData>()
.ForEach((Entity e, in SomeOtherComponent comp) =>
{
// handle entities that are multiple-unit trains
}).Schedule();
// In prefab deserialization/registration pipelines the
// IEmptySerializable marker indicates the component is
// expected to be serialized even though it has no fields.
{{ Notes for modders }}
- Use this component as a tag — it does not carry payload data.
- The StructLayout(Size = 1) is important: some serializers and the engine expect non-zero-sized components for proper serialization/storage. Do not remove or change the size unless you understand the serialization implications.
- Because it implements IQueryTypeParameter, it can be used directly in query definitions (WithAll