Game.Companies.ProcessingCompany
Assembly: Assembly-CSharp.dll
Namespace: Game.Companies
Type: struct
Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary: ProcessingCompany is an empty "tag" or marker ECS component used to mark an entity (a company) as a processing company. It carries no data beyond its existence; the presence of this component on an entity is used by systems and queries to identify companies that perform processing-related behavior. The struct is explicitly laid out with a size of 1 byte so it is addressable/serializable in contexts that require a non-zero size. Implementing IEmptySerializable signals the serializer that the component has no payload but still needs to be represented for compatibility/serialization, and IQueryTypeParameter allows it to be used in ECS query type parameter contexts.
Fields
- This struct declares no instance fields.
Additional metadata: the type is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)], which forces the struct to occupy 1 byte in memory despite having no data fields. This ensures the component is addressable and serializable by systems that expect non-zero sized components.
Properties
- This type does not expose any properties. It is a pure marker component.
Constructors
- The struct relies on the implicit default value-type constructor:
- public ProcessingCompany() The compiler-provided constructor produces the single-byte (zeroed) instance used as the tag.
Methods
- This type does not declare any methods. It functions solely as a tag component for queries and serialization.
Usage Example
// Add the tag to an existing entity (immediate)
entityManager.AddComponentData(entity, new Game.Companies.ProcessingCompany());
// Or using an EntityCommandBuffer (deferred/compatibility with jobified code)
entityCommandBuffer.AddComponent(entity, new Game.Companies.ProcessingCompany());
// Querying entities that have the ProcessingCompany tag
Entities.WithAll<Game.Companies.ProcessingCompany>().ForEach((Entity e, in CompanyData data) =>
{
// process companies that are marked as processing companies
}).Schedule();
Additional notes: - Use this tag in systems to filter or branch logic for processing companies (e.g., factories, recyclers). - Because the component is empty, adding/removing it is an efficient way to change an entity's role without storing per-entity data.