Game.Companies.TransportCompany
Assembly: Assembly-CSharp
Namespace: Game.Companies
Type: struct
Base: Implements: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
TransportCompany is an empty (marker) ECS component used to tag entities as transport companies within the game's data model. The struct is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure a non-zero sized type for serialization and interop despite having no fields. As an IComponentData it participates in Unity's ECS; as IQueryTypeParameter it can be used in queries; IEmptySerializable indicates it is intended to be serializable as an empty marker by the game's custom serialization system.
Fields
- (none — this struct contains no instance fields) {{ This struct is intentionally empty. The StructLayout attribute with Size = 1 ensures it occupies a defined size for serialization/interop even though it carries no data. Empty marker components are commonly used in ECS to classify entities without additional memory overhead beyond the minimal representation. }}
Properties
- (none) {{ There are no properties defined. Use this component purely as a tag. }}
Constructors
public TransportCompany()
{{ No user-defined constructors are present; the default parameterless constructor is provided implicitly by C#. Because this is a value type (struct) with no fields, constructing it yields the empty marker instance. }}
Methods
- (none) {{ The struct does not define methods. Behavior associated with this marker component is implemented elsewhere (systems, queries, or serializers) that check for the presence of TransportCompany on entities. }}
Usage Example
// Tag an entity as a Transport Company using the EntityManager:
using Unity.Entities;
using Game.Companies;
public class Example
{
public void CreateTransportCompanyEntity()
{
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
// Create an entity that has the TransportCompany tag
var archetype = em.CreateArchetype(typeof(TransportCompany));
var entity = em.CreateEntity(archetype);
// Alternatively, add the tag to an existing entity:
// em.AddComponent<TransportCompany>(existingEntity);
}
}
{{ Notes: - Because TransportCompany is an empty marker, systems should check for its presence (HasComponent/WithAll in queries) to operate on transport company entities. - The StructLayout(Size = 1) attribute is used to ensure a stable size for serialization and any native interop; do not remove it unless you understand the serialization implications. }}