protected virtual void handleUpgradeButtonClicked(Sleek2ImageButton button) { int size = (int)Level.size; int num = size / Landscape.TILE_SIZE_INT; for (int i = -num; i < num; i++) { for (int j = -num; j < num; j++) { LandscapeCoord coord = new LandscapeCoord(i, j); LandscapeTile orAddTile = Landscape.getOrAddTile(coord); orAddTile.convertLegacyHeightmap(); orAddTile.convertLegacySplatmap(); for (int k = 0; k < Landscape.SPLATMAP_LAYERS; k++) { orAddTile.materials[k] = this.materials[k]; } orAddTile.updatePrototypes(); } } FoliageVolume foliageVolume = new GameObject { transform = { position = Vector3.zero, rotation = Quaternion.identity, localScale = new Vector3((float)size,Landscape.TILE_HEIGHT, (float)size) } }.AddComponent <FoliageVolume>(); foliageVolume.mode = FoliageVolume.EFoliageVolumeMode.ADDITIVE; foliageVolume.devkitHierarchySpawn(); }