public void GenerateTerrain() { float[,] noiseMap = NoiseGen.GenerateNoiseMap(width, height, seed, scale, octaves, persistance, lacunarity, offset); FoliageGen.removeAllFoliage(); TerrainRendering terrainRendering = FindObjectOfType <TerrainRendering>(); List <ChunkData> chunks = NoiseGen.ChunkNoiseMap(noiseMap); List <MeshData> meshData = new List <MeshData>(); foreach (ChunkData chunkData in chunks) { meshData.Add(MeshGen.GenerateTerrainMesh(chunkData.heightMap, meshHeightMultiplier, meshHeightCurve, chunkData.chunkCoords, regions)); } if (useShader) { terrainRendering.DrawMesh(meshData, meshScale, shaderMaterial); } else { terrainRendering.DrawMesh(meshData, meshScale, null); } UpdateShaderData(); }