Example #1
0
    public static GameObject CreateTerrain(TerrainSaveData data)
    {
        GameObject terrain = new GameObject("Terrain");
        Biome      biome   = GetBiome(data.biomeID);

        Mesh mesh = GenerateMesh(data.noiseMap, biome);

        terrain.AddComponent <MeshFilter>().mesh       = mesh;
        terrain.AddComponent <MeshRenderer>().material = biome.CreateMaterial();

        return(terrain);
    }