Skip to content

Game.TerrainPropertiesPrefab

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
TerrainPropertiesPrefab is a prefab class that carries configuration for terrain-related water properties used by the simulation. It exposes an array of water sources and several integer parameters controlling discretization/steps and max speed used by the terrain water system. When preparing entity archetypes, this prefab ensures the TerrainPropertiesData component is included so that terrain water data is present on created entities.


Fields

  • public WaterSystem.WaterSource[] m_WaterSources
    Array of water source definitions associated with this terrain prefab. Each entry represents a source definition from the WaterSystem (type nested under Game.Simulation). Used by the terrain/water simulation to initialize or reference water sources for the terrain.

  • public int m_WaterSourceSteps
    Integer parameter controlling the number of steps or resolution used when processing water sources. Used by the water simulation to discretize or iterate water source-related calculations.

  • public int m_WaterVelocitySteps
    Integer parameter controlling the number of discrete steps for computing or sampling water velocity. Affects the resolution or iteration count for velocity-related water simulation logic.

  • public int m_WaterDepthSteps
    Integer parameter controlling the discretization / step count for water depth computations. Higher values increase resolution of depth-related simulations or sampling.

  • public int m_WaterMaxSpeed
    Maximum speed value (integer) used as a limit in the water simulation for the terrain. Constrains calculated water velocities or acts as a cap for simulation stability.

Properties

  • (none declared in this class)
    This prefab does not declare properties; it exposes public fields for configuration.

Constructors

  • public TerrainPropertiesPrefab()
    Default constructor (inherited behavior from PrefabBase). No custom initialization logic is present in this class; fields are expected to be set by prefab data (e.g., from editor or prefab asset).

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Collects the set of ECS component types required by this prefab. This method calls the base implementation and then adds the TerrainPropertiesData component as a read/write component type:
  • Calls base.GetPrefabComponents(components).
  • Adds ComponentType.ReadWrite<TerrainPropertiesData>(). This ensures entities created from this prefab will include TerrainPropertiesData so the terrain water simulation has the data it needs.

Usage Example

// Example override showing how TerrainPropertiesPrefab ensures TerrainPropertiesData is included
public class MyTerrainPrefab : TerrainPropertiesPrefab
{
    public override void GetPrefabComponents(HashSet<ComponentType> components)
    {
        base.GetPrefabComponents(components);
        // components now contains ComponentType.ReadWrite<TerrainPropertiesData>()
        // You can add additional components required by your custom prefab here:
        // components.Add(ComponentType.ReadWrite<MyCustomData>());
    }
}

Additional notes for modders: - TerrainPropertiesPrefab is intended to be used as part of the prefab system for terrain-related entities. When creating or modifying terrain prefabs, ensure the fields (m_WaterSources, step counts, max speed) are populated appropriately for the desired simulation behavior. - The added component type is TerrainPropertiesData — to read or write terrain-specific water properties at runtime, implement systems that operate on entities with that component. - WaterSystem.WaterSource is defined under Game.Simulation (imported in the source). Inspect that type for details about the shape/fields of each water source entry.