Skip to content

Game.Prefabs.TerrainAreaData

Assembly: Assembly-CSharp (default game assembly)
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
Represents per-area terrain parameters used by the terrain generation / painting systems. This value-type component stores simple floats that control height offset, slope blending width, and procedural noise used when composing or modifying terrain for a specific prefab/area. It is intended to be attached to entities as an IComponentData for use in DOTS/ECS systems that produce or modify terrain.


Fields

  • public float m_HeightOffset
    A vertical offset applied to the terrain for this area (in world units). Positive values raise the terrain; negative values lower it.

  • public float m_SlopeWidth
    Controls the width/feathering of slope blending at area boundaries. Larger values produce smoother transitions between adjacent areas.

  • public float m_NoiseScale
    Scale factor for the procedural noise used to perturb terrain shape. Higher values change the frequency/scale of the noise pattern.

  • public float m_NoiseFactor
    Amplitude multiplier for the procedural noise. Determines how strongly the noise affects the final terrain height.

  • public float m_AbsoluteHeight
    An absolute world-space height override for the terrain in this area. When used, this can force the terrain to a specific elevation (behavior depends on consuming systems).

Properties

  • This type has no properties; it exposes five public fields as its data.

Constructors

  • public TerrainAreaData()
    Default struct constructor (auto-generated). All fields are initialized to 0.0f. Initialize fields explicitly before use to avoid unintended behavior.

Methods

  • This struct defines no methods. It is a plain data container intended for use with ECS systems.

Usage Example

// Create and initialize the component data
var terrainArea = new TerrainAreaData
{
    m_HeightOffset = 1.5f,
    m_SlopeWidth = 2.0f,
    m_NoiseScale = 0.35f,
    m_NoiseFactor = 0.8f,
    m_AbsoluteHeight = 0.0f
};

// Attach to an entity using an EntityManager (example)
entityManager.AddComponentData(entity, terrainArea);

// Systems that generate or modify terrain can read these fields and apply
// height offsets, blending, and noise when producing terrain meshes/heights.

Notes: - Fields are public and copied by value (struct semantics). Mutating a local copy will not affect the component stored on an entity unless you write it back via SetComponentData/AddComponentData. - The meaning of m_AbsoluteHeight versus m_HeightOffset depends on consumer systems; check terrain-generation code to know which takes precedence.