Skip to content

Game.FixedNetSegmentInfo

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

Type: class

Base: System.Object

Summary:
Represents configuration data for a fixed segment within a network prefab (net piece) used by the game's road/rail network system. This serializable container describes how many pieces are present, the nominal length of the segment, whether it can be curved, and per-piece state requirements for "set" (present) and "unset" (absent) states. Typically serialized into net prefab data and consumed by the engine or by editors/mods manipulating net prefabs.


Fields

  • public Unity.Mathematics.int2 m_CountRange
    Specifies the allowed count range for pieces in this segment. int2.x is the minimum count and int2.y is the maximum count. Used to indicate how many repeated pieces of this segment may appear.

  • public float m_Length
    Nominal length of this segment piece (in the game's length units). Used by placement/layout logic to compute distances when building or rendering network pieces.

  • public bool m_CanCurve
    If true, the segment is allowed to curve; if false, it should be treated as a straight segment when the net is laid out.

  • public NetPieceRequirements[] m_SetState
    Array of NetPieceRequirements that define the required components/conditions for each piece when it is in the "set" (present) state. The array typically corresponds to subpieces or variants that should exist for the segment to be considered present.

  • public NetPieceRequirements[] m_UnsetState
    Array of NetPieceRequirements that define the required components/conditions for each piece when it is in the "unset" (absent) state. Used to describe what should be true when that piece is not present.

Properties

  • This type does not declare any properties. It exposes its data via public fields and is marked [Serializable] for prefab serialization.

Constructors

  • public FixedNetSegmentInfo()
    Default parameterless constructor (compiler-generated). Instances are typically created by deserialization or by code that builds/modifies prefab data.

Methods

  • This type does not declare any methods. It is a plain data container used by prefab serialization and the net-building code.

Usage Example

using Unity.Mathematics;
using Game.Prefabs;

// Create a new segment info for a straight segment that can curve,
// with 1..2 repeated pieces and a length of 8 units.
var segment = new FixedNetSegmentInfo {
    m_CountRange = new int2(1, 2),
    m_Length = 8f,
    m_CanCurve = true,
    // NetPieceRequirements is a game type describing required components;
    // fill with appropriate values for your prefab structure.
    m_SetState = new NetPieceRequirements[] {
        /* new NetPieceRequirements(...) */
    },
    m_UnsetState = new NetPieceRequirements[] {
        /* new NetPieceRequirements(...) */
    }
};

Notes for modders: - The class is marked [Serializable] and is intended to be serialized as part of net prefab data. When creating or editing net prefabs, ensure SetState and UnsetState arrays match the expected piece ordering and requirements used by the engine. - int2 is from Unity.Mathematics; ensure your mod references Unity.Mathematics if constructing instances in code.