Game.NetSectionInfo
Assembly:
Assembly-CSharp
Namespace:
Game.Prefabs
Type:
class
Base:
System.Object
Summary:
Serializable container describing a single section definition for a network (road/track) prefab. NetSectionInfo groups a reference to the concrete section prefab and the rules that determine when this section should be used (requirements), visibility masks, orientation and placement flags, and a local positional offset. Instances are typically used by higher-level NetPrefabs or network building systems to decide which section pieces to spawn when constructing a road/rail segment.
Fields
-
public NetSectionPrefab m_Section
Reference to the actual section prefab this entry represents. This prefab defines the mesh, props, lanes and other visual/functional details for the section. -
public NetPieceRequirements[] m_RequireAll
Array of requirements that must all be satisfied for this section to be considered valid. Each element is a NetPieceRequirements rule (for example: specific lane count, vehicle types, decorations). -
public NetPieceRequirements[] m_RequireAny
Array of alternative requirements where at least one must be satisfied for this section to be valid. Useful for covering multiple acceptable conditions with a single section entry. -
public NetPieceRequirements[] m_RequireNone
Array of requirements that must NOT be present for this section to be valid. Use to exclude a section when certain features are present. -
public NetPieceLayerMask m_HiddenLayers
Layer mask indicating which net piece layers should be hidden when this section is used. Controls selective visibility of parts of a section depending on context. -
public bool m_Invert
If true, invert the meaning of the requirement tests or flip some selection logic (specific semantics depend on the code that evaluates these flags). -
public bool m_Flip
If true, the section should be flipped (mirrored) horizontally when placed. Commonly used for asymmetrical sections to reuse the same mesh for both sides. -
public bool m_Median
Indicates that this section acts as a median (center) section. Affects placement rules and how lanes/props align relative to the road center. -
public bool m_HalfLength
If true, this section is intended to be half-length (shorter) than the default section. Used for fine placement and matching segment lengths. -
public float3 m_Offset
Local offset (Unity.Mathematics.float3) applied to the section when placed. Useful for nudging the mesh vertically or sideways to better align with other pieces.
Properties
This type defines no public properties beyond the public fields listed above. It is a plain data container (POCO) with public fields for serialization and editor access.
Constructors
public NetSectionInfo()
Default parameterless constructor (implicit). As a simple serializable data class, instances are typically created and then fields populated either via serialization (editor/prefab) or in code.
Methods
This type declares no methods. Behavior (requirements evaluation, placement, flipping, etc.) is implemented by the networking/prefab system that consumes NetSectionInfo data.
Usage Example
// Create and configure a section entry in code (normally done in editor/prefab files)
var sectionInfo = new NetSectionInfo
{
m_Section = someSectionPrefab, // NetSectionPrefab reference
m_RequireAny = new[] { requirementA }, // e.g. allow when requirementA OR requirementB matches
m_RequireAll = new NetPieceRequirements[0],
m_RequireNone = new NetPieceRequirements[0],
m_HiddenLayers = NetPieceLayerMask.None,
m_Flip = false,
m_Invert = false,
m_Median = false,
m_HalfLength = false,
m_Offset = new Unity.Mathematics.float3(0f, 0.1f, 0f) // small vertical offset
};
Notes: - The class is decorated with [Serializable], meaning its fields are intended to be serialized by Unity and edited in the inspector. - Evaluation semantics for the requirement arrays and flags are implemented elsewhere; this class only stores the configuration.