Skip to content

Game.Prefabs.ObjectSubNetInfo

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: System.Object

Summary:
Serializable container type used by the game's prefab system to describe a "sub-net" (a sub-piece or segment) of a network/object prefab. It groups a reference to the underlying NetPrefab, geometric information for the sub-piece in the form of a Bezier curve, node/mesh indices used to locate or attach the sub-piece within larger mesh structures, and an optional array of upgrade requirements. This class is a plain data holder (no custom constructor or methods defined in the source file) and is intended to be serialized by Unity's serializer.


Fields

  • public NetPrefab m_NetPrefab
    Reference to the NetPrefab that this sub-net belongs to. This points to the prefab asset that defines the network piece (for example, a road or track segment) whose subcomponent is represented by this instance.

  • public Bezier4x3 m_BezierCurve
    Bezier curve data describing the geometry of the sub-net piece. Bezier4x3 typically encodes four control points each with three components (x/y/z) and is used to position/shape the piece along a curved path.

  • public int2 m_NodeIndex = new int2(-1, -1)
    A two-component integer index (from Unity.Mathematics.int2) used to identify a node related to this sub-net. Defaults to (-1, -1), indicating an uninitialized or "no node" state. The two components can represent indices such as (meshIndex, vertexIndex) or (submeshIndex, nodeId) depending on consumer code.

  • public int2 m_ParentMesh = new int2(-1, -1)
    Two-component integer used to identify the parent mesh or parent mesh slot for this sub-net. Also defaults to (-1, -1) to indicate an invalid/unassigned parent. Consumers use this to locate the mesh that owns or will render this sub-net.

  • public NetPieceRequirements[] m_Upgrades
    Optional array of NetPieceRequirements describing any upgrade/transition requirements for this sub-net (for example, which other pieces are required or allowed as upgrades). May be null or empty if no upgrade requirements apply.

Properties

  • This class defines no properties. All state is exposed as public fields for (de)serialization and data access.

Constructors

  • No explicit constructors are defined in the source file. The class uses the default parameterless constructor provided by the runtime. The field defaults are:

  • m_NodeIndex and m_ParentMesh are initialized to new int2(-1, -1) in-field.

  • Other fields (m_NetPrefab, m_BezierCurve, m_Upgrades) will be default-initialized (null for reference/array types; default struct value for Bezier4x3).

Methods

  • This class does not declare any methods in the provided source file. It is a simple data container.

Usage Example

// Create a new ObjectSubNetInfo and assign its core data
var subNet = new ObjectSubNetInfo();

// Assign a reference to an existing NetPrefab (obtained from prefab manager or created elsewhere)
subNet.m_NetPrefab = myNetPrefab; // NetPrefab instance

// Set Bezier geometry (example assumes Bezier4x3 provides a suitable constructor or field assignment)
subNet.m_BezierCurve = myBezierCurve;

// Set node and parent mesh indices (use -1 to indicate unassigned)
subNet.m_NodeIndex = new Unity.Mathematics.int2(0, 2);
subNet.m_ParentMesh = new Unity.Mathematics.int2(1, 0);

// Provide upgrade requirements if applicable
subNet.m_Upgrades = new NetPieceRequirements[] { upgradeReq1, upgradeReq2 };

// The created instance can be serialized/deserialized by Unity or used by prefab/mesh builders

Notes: - The class is marked with [Serializable] so Unity's serialization system can persist instances in asset data or scene data. - The meaning of the two components in int2 fields is dependent on calling code; consult consumers (mesh builders, prefab processors) for exact semantics.