void OnWizardCreate() { TerrainVolumeData data = VolumeDataAsset.CreateEmptyVolumeData <TerrainVolumeData>(new Region(0, 0, 0, width - 1, height - 1, depth - 1)); if (generateFloor) { // Create some ground in the terrain so it shows up in the editor. // Soil as a base (mat 1) and then a couple of layers of grass (mat 2). TerrainVolumeGenerator.GenerateFloor(data, 6, (uint)1, 8, (uint)2); } }
static void CreateTerrainVolume() { int width = 128; int height = 32; int depth = 128; TerrainVolumeData data = VolumeDataAsset.CreateEmptyVolumeData <TerrainVolumeData>(new Region(0, 0, 0, width - 1, height - 1, depth - 1)); // Create some ground in the terrain so it shows up in the editor. // Soil as a base (mat 1) and then a couple of layers of grass (mat 2). TerrainVolumeGenerator.GenerateFloor(data, 6, (uint)1, 8, (uint)2); // Now create the terrain game object from the data. GameObject terrain = TerrainVolume.CreateGameObject(data, true, true); // And select it, so the user can get straight on with editing. Selection.activeGameObject = terrain; }