Skip to content

Game.Net.LaneConnection

Assembly:
Game (Game.dll is the likely assembly containing Game.Net types)

Namespace: Game.Net

Type: struct (value type)

Base: Implements: - Unity.Entities.IComponentData - Unity.Entities.IQueryTypeParameter - Colossal.Serialization.Entities.ISerializable

Summary: Represents a connection between two lane entities including the endpoints along those lanes. This is a lightweight ECS component (struct) used to store a link from a start lane to an end lane together with float positions on each lane. The type is serializable via the game's IWriter/IReader interfaces and is suitable for DOTS/EntityManager use. The float fields represent positions along the respective lanes (typically interpreted as a position along the lane; modders should treat them as relative or lane-local coordinates depending on surrounding code).


Fields

  • public Unity.Entities.Entity m_StartLane The Entity reference for the lane where the connection starts. This should be a valid lane Entity (or Entity.Null when not set). Serialized first in the wire format.

  • public Unity.Entities.Entity m_EndLane The Entity reference for the lane where the connection ends. Serialized second.

  • public float m_StartPosition A float describing the position along the start lane where the connection occurs. Serialized third. Typically used as a lane-local coordinate (interpretation depends on calling code).

  • public float m_EndPosition A float describing the position along the end lane where the connection occurs. Serialized fourth.

Properties

  • This type exposes no C# properties; it uses public fields for data storage.

Constructors

  • public LaneConnection() Implicit default constructor. All fields default to zero/Entity.Null. There is no explicit constructor defined in the source.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter Writes the component fields in the following order to the provided writer:
  • m_StartLane
  • m_EndLane
  • m_StartPosition
  • m_EndPosition

Maintain this order for compatibility with the corresponding Deserialize implementation.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader Reads and populates the component fields from the provided reader in the same order they were serialized:
  • m_StartLane
  • m_EndLane
  • m_StartPosition
  • m_EndPosition

Fields are read by reference into the struct fields.

Usage Example

// Create and populate a LaneConnection and add it to an entity (ECS / DOTS)
var connection = new Game.Net.LaneConnection
{
    m_StartLane = startLaneEntity,   // Entity obtained elsewhere
    m_EndLane = endLaneEntity,       // Entity obtained elsewhere
    m_StartPosition = 0.25f,         // example lane-local position
    m_EndPosition = 0.75f            // example lane-local position
};

var entityManager = Unity.Entities.World.DefaultGameObjectInjectionWorld.EntityManager;
// Add the connection component to an entity that represents the link object
entityManager.AddComponentData(linkEntity, connection);

// Serialization example (writer implementation provided by game serialization framework)
someWriter.Write(connection); // or connection.Serialize(someWriter) depending on API usage

// Deserialization example
Game.Net.LaneConnection readConnection;
readConnection.Deserialize(someReader); // or someReader.Read(out readConnection)

Notes: - Preserve the serialize/deserialize order to ensure save/load and network compatibility. - The interpretation (units/range) of the position floats depends on other lane APIs; treat them as lane-local positions unless documentation elsewhere specifies absolute units.