public GroundLayer AddLayer(Texture2D albedo, float albedoTiling = 1, Texture2D normal = null, float normalTiling = 1) { GroundLayer tmp = new GroundLayer(otherLayerMaterial, albedo, albedoTiling, normal, normalTiling); groundLayers.Add(tmp); ApplyLayer(tmp); return(tmp); }
private void ApplyLayer(GroundLayer groundLayer) { Material[] tmp = new Material[terrains[0, 0].materials.Length + 1]; for (int i = 0; i < terrains[0, 0].materials.Length; i++) { tmp[i] = terrains[0, 0].materials[i]; } tmp[terrains[0, 0].materials.Length] = groundLayer.groundMaterial; for (int j = 0; j < terrainCount.y; j++) { for (int i = 0; i < terrainCount.x; i++) { terrains[i, j].materials = tmp; } } groundLayer.Apply(); }