Game.Objects.Secondary
Assembly: Assembly-CSharp
Namespace: Game.Objects
Type: struct
Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
Secondary is an empty ("tag") DOTS component used to mark or categorize entities. The StructLayout attribute (LayoutKind.Sequential, Size = 1) forces the type to occupy 1 byte in memory. Implementing IComponentData makes it usable as an ECS component; IQueryTypeParameter enables it to be used directly in query/WithAll style APIs; IEmptySerializable indicates to Colossal's serializer that the component has no serializable payload (helps avoid writing data for this component).
Fields
- This struct contains no instance fields.
The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute ensures it still occupies a single byte when stored in component memory.
Properties
- This type defines no properties.
Constructors
public Secondary()
Structs have an implicit default constructor that produces an empty value. No custom constructor is defined.
Methods
- This type defines no methods.
Usage Example
// Add the marker to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponentData(entity, new Game.Objects.Secondary());
// Query or filter entities that have the marker
public partial class ExampleSystem : SystemBase
{
protected override void OnUpdate()
{
// Run on entities that are tagged with Secondary
Entities
.WithAll<Game.Objects.Secondary>()
.ForEach((ref Translation trans) =>
{
// your logic here
})
.ScheduleParallel();
}
}
Notes: - Use Secondary as a lightweight tag for grouping, filtering, or conditional processing of entities in systems. - Because it implements IEmptySerializable, Colossal's serialization should treat it as having no payload; useful for saving/loading where the presence/absence of the tag is all that matters.