From 3681d6831974fa16daca30e52b66e4b6fbc3218c Mon Sep 17 00:00:00 2001 From: Vykula Date: Fri, 16 Feb 2024 15:50:22 +0200 Subject: [PATCH] fixed boundaries of painted area solved the issue with one line and one row having no color --- Assets/Scripts/Managers/TerrainGenerationManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Managers/TerrainGenerationManager.cs b/Assets/Scripts/Managers/TerrainGenerationManager.cs index 9282c77..a0d9578 100644 --- a/Assets/Scripts/Managers/TerrainGenerationManager.cs +++ b/Assets/Scripts/Managers/TerrainGenerationManager.cs @@ -126,9 +126,9 @@ private void PaintTerrain() // Loop through each point on terrain and set color depending on height and selected gradient. var selectedGradient = gradients[SelectedGradientTypeAsNumber]; - for (int x = 0; x < terrain.terrainData.heightmapResolution; x++) + for (int x = 0; x < terrain.terrainData.heightmapResolution - 1; x++) { - for (int y = 0; y < terrain.terrainData.heightmapResolution; y++) + for (int y = 0; y < terrain.terrainData.heightmapResolution - 1; y++) { float height = heights[x, y]; Color color = selectedGradient.Evaluate(height);