Skip to content

Game.Companies.OutsideTrader

Assembly: Assembly-CSharp
Namespace: Game.Companies

Type: struct

Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary: OutsideTrader is an empty (marker) ECS component used to tag entities as "outside traders". The struct is explicitly laid out with a 1-byte size via [StructLayout(LayoutKind.Sequential, Size = 1)] so it is not treated as a typical zero-sized tag in memory. Implements IComponentData so it can be attached to entities, and IQueryTypeParameter so it can be used as a query/filter parameter in ECS queries.


Fields

  • (none)
    This struct does not declare any managed fields. The StructLayout attribute sets the size to 1 byte, but no named fields exist in source.

Properties

  • (none)
    There are no properties defined.

Constructors

  • public OutsideTrader()
    The default parameterless constructor is the implicit struct constructor — no initialization is required.

Methods

  • (none)
    No methods are defined on this type.

Usage Example

// Add the marker component to an entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponentData(someEntity, new Game.Companies.OutsideTrader());

// Example SystemBase that queries entities tagged as OutsideTrader
public partial class OutsideTraderSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Use WithAll<OutsideTrader>() (IQueryTypeParameter support) to filter entities
        Entities
            .WithAll<Game.Companies.OutsideTrader>()
            .ForEach((Entity entity) =>
            {
                // Process outside trader entity...
            })
            .Schedule();
    }
}

Notes: - Because the struct is essentially a marker, use it when you only need to identify or filter entities (e.g., outside trading behavior) without storing additional data. - The StructLayout(Size = 1) enforces a 1-byte size for the component; this can be important when the developer intends the component to occupy non-zero space or to interoperate with low-level code or native plugins.