Skip to content

Game.Prefabs.ConnectionLane

Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Prefabs

Type: class

Base: ComponentBase

Summary:
ConnectionLane is a small prefab helper component used by the game's prefab-to-ECS plumbing for net lane prefabs. It registers the ECS component types that should be present on prefab entities and on the runtime archetype for lane prefabs. The class is annotated with a ComponentMenu attribute so it appears under the "Net/" menu and is associated with NetLanePrefab assets in the editor. Use this component on a NetLanePrefab to ensure entities created from that prefab include ConnectionLaneData (prefab component) and Game.Net.ConnectionLane (archetype/runtime component).


Fields

  • None.
    {{ This class does not declare any instance or static fields. It only overrides methods from ComponentBase to add component types to prefab/archetype sets. }}

Properties

  • None.
    {{ There are no properties declared on this component. }}

Constructors

  • public ConnectionLane()
    {{ The class has only the default parameterless constructor (compiler-provided). No custom construction logic is required. }}

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    {{ Adds ComponentType.ReadWrite() to the provided components set. This ensures the prefab will include the ConnectionLaneData component when converted to an ECS entity/prefab. The method is called by the prefab conversion/registration pipeline. }}

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    {{ Adds ComponentType.ReadWrite() to the provided components set. This ensures that runtime entities instantiated from the prefab will have the Game.Net.ConnectionLane component in their archetype. This is used to put lane-specific runtime state on created entities. }}

Additional attributes: - [ComponentMenu("Net/", new Type[] { typeof(NetLanePrefab) })]
{{ Registers this component in the editor component menu under "Net/" and associates it with NetLanePrefab so designers can attach it to NetLanePrefab assets. }}

Usage Example

// Attach this component to a NetLanePrefab in the editor (it is registered under ComponentMenu "Net/")
// The prefab conversion system will call the methods above and add the listed ECS component types:
// - ConnectionLaneData as a prefab component
// - Game.Net.ConnectionLane on the runtime archetype
[ComponentMenu("Net/", new Type[] { typeof(NetLanePrefab) })]
public class ConnectionLane : ComponentBase
{
    public override void GetPrefabComponents(HashSet<ComponentType> components)
    {
        components.Add(ComponentType.ReadWrite<ConnectionLaneData>());
    }

    public override void GetArchetypeComponents(HashSet<ComponentType> components)
    {
        components.Add(ComponentType.ReadWrite<Game.Net.ConnectionLane>());
    }
}

{{Notes: If you need to add additional data or functionality for lane prefabs, extend this component to register more component types or create companion MonoBehaviour/authoring components that populate those components during conversion.}}