void generateTerrain() { splatmapData = new float[myTerrain.terrainData.alphamapResolution, myTerrain.terrainData.alphamapResolution, myTerrain.terrainData.alphamapLayers]; Fractals fractalCode = gameObject.AddComponent <Fractals>(); fractalCode.generateFractal(ref heights, size_x, 3.3f); normalizeHeights(); for (int x = 0; x < size_x; x++) { for (int y = 0; y < size_x; y++) { if (heights [x, y] <= 0.1f) //water { splatmapData [x, y, 7] = 1; heights [x, y] = 0.1f; } else if (heights [x, y] <= 0.12f) //sand { splatmapData [x, y, 4] = 1; } else if (heights [x, y] <= 0.20f) //grass { splatmapData [x, y, 6] = 1; } else if (heights [x, y] <= 0.64f) //forest { splatmapData [x, y, 5] = 1; } else if (heights [x, y] <= 0.82f) //stone { splatmapData [x, y, 11] = 1; } else //ice { splatmapData [x, y, 10] = 1; } } } myTerrain.terrainData.SetHeights(0, 0, heights); myTerrain.terrainData.SetAlphamaps(0, 0, splatmapData); //make sure to get rid of heights[,] and only use tempHeights[,] //also, might want to change the roughness sent to fractal method }