Game.Prefabs.NetTerrainData
Assembly: Assembly-CSharp (runtime component assembly used by the game/mod)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
A small ECS component that stores per-prefab terrain offset parameters for net (road/rail) prefabs. The fields are vector offsets used by terrain handling and clipping logic when placing or rendering network segments. This struct is plain data (value type) intended to be attached to entities representing net prefabs so systems can read terrain-related offsets efficiently.
Fields
-
public float2 m_WidthOffset
Horizontal offsets for width-related terrain adjustments. Typically used to shift or pad the terrain sampling/placement along the two horizontal axes (e.g., left/right offsets for the network segment width). Values are in world units (meters) as float components. -
public float2 m_ClipHeightOffset
Offsets applied to clipping heights when determining where the net intersects or is clipped by terrain or other geometry. Two-component float, usually representing different clipping offsets for directions or layers. -
public float3 m_MinHeightOffset
Minimum height offset vector used for clamping or defining a lower bound for terrain adjustments. The 3D vector can encode per-axis or per-corner minimum offsets depending on the prefab/system interpretation. -
public float3 m_MaxHeightOffset
Maximum height offset vector used for clamping or defining an upper bound for terrain adjustments. Like m_MinHeightOffset, this is a 3-component float vector used by terrain/placement logic.
Properties
- None.
This struct exposes only plain public fields and implements IComponentData for use in Unity DOTS/ECS.
Constructors
public NetTerrainData()
(implicit default)
As a value type, NetTerrainData has the implicit default constructor that zero-initializes all fields. You can also create and initialize an instance with an object initializer.
Methods
- None.
This type contains only data fields and no behavior; systems operating on entities with this component implement the logic.
Usage Example
// Create and attach the component to an entity (EntityManager API)
var terrainData = new NetTerrainData
{
m_WidthOffset = new float2(0.5f, 0.5f),
m_ClipHeightOffset = new float2(0.1f, 0.1f),
m_MinHeightOffset = new float3(-0.2f, -0.2f, -0.2f),
m_MaxHeightOffset = new float3(0.2f, 0.2f, 0.2f)
};
entityManager.AddComponentData(prefabEntity, terrainData);
// Read/modify in a system (Entities.ForEach or ISystem/IJobChunk)
Entities.ForEach((ref NetTerrainData netTerrain) =>
{
// example: expand horizontal width offsets slightly
netTerrain.m_WidthOffset += new float2(0.1f, 0.1f);
}).Schedule();