Skip to content

Game.Prefabs.RouteOptionData

Assembly:
Assembly-CSharp

Namespace:
Game.Prefabs

Type:
struct (value type)

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

Summary:
Component data used to store a route option bitmask for prefabs/entities. The single field (m_OptionMask) is a 32-bit unsigned integer intended to represent route option flags (each bit typically corresponds to a route option). This struct is a plain, blittable DOTS component that can be attached to entities and used in entity queries or systems. {{ Use this component to store and query route option flags; interpret bits with a flags enum or named constants for readability. }}


Fields

  • public System.UInt32 m_OptionMask
    Stores a bitmask of route options. Each bit can represent one option/flag (for example: allow buses, allow trams, one-way flag, etc.). Default value is 0 when the struct is default-initialized. {{ Treat the mask as an opaque bitfield in code; define a [Flags] enum or constants in your mod to make bit tests and assignments clearer and safer. }}

Properties

  • None.
    {{ This struct exposes no properties — it's a plain data container (IComponentData). }}

Constructors

  • Implicit default constructor (all fields zero-initialized)
    {{ As a value type, RouteOptionData has a compiler-provided default constructor that sets m_OptionMask to 0. You can construct it inline with an object initializer: new RouteOptionData { m_OptionMask = value }. If you need convenience constructors, create helper methods or extension constructors in your code. }}

Methods

  • None.
    {{ No methods are defined on this component. Use systems / jobs to operate on entities that have this component. Because it's blittable and contains only a primitive, it is safe to use in Burst jobs and parallelized systems. }}

Usage Example

// Add component to an entity with a specific mask
var mask = 0x1u; // example: bit 0 == some route option
entityManager.AddComponentData(entity, new RouteOptionData { m_OptionMask = mask });

// Read or modify in a system (EntityQuery / Entities.ForEach)
Entities
    .WithAll<RouteOptionData>()
    .ForEach((ref RouteOptionData routeData) =>
    {
        // check if bit 0 is set
        bool option0 = (routeData.m_OptionMask & 0x1u) != 0;
        // set bit 2
        routeData.m_OptionMask |= (1u << 2);
    }).Schedule();

{{ YOUR_INFO }}