Skip to content

Game.Prefabs.AuxiliaryLanes

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: class

Base: ComponentBase

Summary:
Component that holds references to auxiliary lane prefabs used by a net/prefab. It exposes those lane prefabs as dependencies so they are loaded/instantiated with the parent prefab, and it registers the AuxiliaryNetLane component type for prefab entity creation. The component is annotated for the editor with a ComponentMenu for "Net/" and a suggested related type NetLanePrefab.


Fields

  • public AuxiliaryLaneInfo[] m_AuxiliaryLanes
    Array of auxiliary lane definitions. Each AuxiliaryLaneInfo typically contains a reference to a lane prefab (m_Lane). This array is iterated in GetDependencies to add referenced lane prefabs to the dependency list. Ensure the array and its entries are initialized in the prefab to avoid null-reference issues at runtime.

Properties

  • public override bool ignoreUnlockDependencies { get; }
    Overrides ComponentBase.ignoreUnlockDependencies and always returns true. This means the component's dependencies are treated as always required/loaded regardless of unlock dependencies, ensuring auxiliary lane prefabs are available even if unlocks would otherwise prevent them.

Constructors

  • public AuxiliaryLanes()
    Default constructor (compiler-generated). Typical usage is to configure the m_AuxiliaryLanes array on the prefab asset rather than constructing this class at runtime.

Methods

  • public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
    Adds referenced lane prefabs from m_AuxiliaryLanes to the provided prefabs list. Implementation details:
  • Calls base.GetDependencies(prefabs).
  • Iterates m_AuxiliaryLanes and adds each m_AuxiliaryLanes[i].m_Lane to the list.
  • Note: If m_AuxiliaryLanes or any entry is null, a null-reference can occur; prefabs should validate entries in the editor/prefab asset.

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Registers component types required by the prefab. Specifically adds ComponentType.ReadWrite() so entities created from this prefab will include the AuxiliaryNetLane component.

  • public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Empty implementation in this class — no additional archetype components are added here. Archetype-level components remain unchanged by this component.

Usage Example

// Example: Subclassing to add additional dependencies or adjust behavior
[Preserve]
public class MyAuxiliaryLanes : AuxiliaryLanes
{
    public override void GetDependencies(List<PrefabBase> prefabs)
    {
        base.GetDependencies(prefabs);
        // add extra dependencies if needed:
        // prefabs.Add(someOtherPrefab);
    }
}

// Example: Typical prefab configuration (done in asset/prefab authoring, not runtime):
// - Assign m_AuxiliaryLanes[] in the prefab inspector, each entry's m_Lane set to a NetLanePrefab.
// The component will ensure those lane prefabs are treated as dependencies and that the
// AuxiliaryNetLane component is available on created entities.