Skip to content

Game.Net.LaneObjectAction

Assembly: Assembly-CSharp (typical for game code / mods)
Namespace: Game.Net

Type: struct

Base: System.IComparable

Summary: Represents a pending lane object operation tied to a specific lane entity. A LaneObjectAction can represent adding an object (m_Add), removing an object (m_Remove), or replacing an object on a lane. It also stores a curve position (m_CurvePosition) for placement along the lane. Instances are comparable by the lane entity index, which allows sorting/grouping actions by lane.


Fields

  • public Unity.Entities.Entity m_Lane Holds the lane Entity that this action targets. Comparison and hashing are based on this field.

  • public Unity.Entities.Entity m_Remove If non-null, denotes the Entity to be removed from the lane. Mutually exclusive with m_Add for simple operations.

  • public Unity.Entities.Entity m_Add If non-null, denotes the Entity to be added to the lane. Mutually exclusive with m_Remove for simple operations.

  • public Unity.Mathematics.float2 m_CurvePosition A 2D value describing the position on the lane curve where the add/replacement should occur (usually fractional/normalized coordinates along the lane).

Properties

  • None. This struct exposes only public fields; there are no properties.

Constructors

  • public LaneObjectAction(Unity.Entities.Entity lane, Unity.Entities.Entity remove) Creates an action that targets lane and will remove the specified remove entity. m_Add is set to Entity.Null and m_CurvePosition is set to default.

  • public LaneObjectAction(Unity.Entities.Entity lane, Unity.Entities.Entity add, Unity.Mathematics.float2 curvePosition) Creates an action to add add to lane at curvePosition. m_Remove is set to Entity.Null.

  • public LaneObjectAction(Unity.Entities.Entity lane, Unity.Entities.Entity remove, Unity.Entities.Entity add, Unity.Mathematics.float2 curvePosition) Creates an action that can represent a replacement (both remove and add) at the given curvePosition on lane.

Methods

  • public int CompareTo(LaneObjectAction other) Compares this action with other by subtracting the lane entity index (m_Lane.Index - other.m_Lane.Index). Useful for sorting actions so operations targeting the same or nearby lanes are grouped.

  • public override int GetHashCode() Returns the hash code of m_Lane (delegates to m_Lane.GetHashCode()). Use caution: hash is based solely on the lane entity.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using System.Collections.Generic;

// Create some example Entity values (in real usage these come from your ECS world)
Entity laneEntity = /* obtain lane entity */;
Entity toRemove = /* obtain object entity to remove */;
Entity toAdd = /* obtain object entity to add */;

// Create actions
var removeAction = new Game.Net.LaneObjectAction(laneEntity, toRemove);
var addAction = new Game.Net.LaneObjectAction(laneEntity, toAdd, new float2(0.5f, 0f));

// Replacement (remove + add at specific curve position)
var replaceAction = new Game.Net.LaneObjectAction(laneEntity, toRemove, toAdd, new float2(0.25f, 0f));

// Collect and sort actions by lane index to group per-lane operations
var actions = new List<Game.Net.LaneObjectAction> { addAction, removeAction, replaceAction };
actions.Sort(); // uses CompareTo to sort by m_Lane.Index

// Use GetHashCode if required for dictionary keys keyed by lane entity semantics
int laneHash = removeAction.GetHashCode();