-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuEntries.cs
33 lines (28 loc) · 1009 Bytes
/
MenuEntries.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using ProceduralToolkit.Components.Startups;
using UnityEditor;
using UnityEngine;
namespace ProceduralToolkit
{
public static class MenuEntries
{
[MenuItem("GameObject/ProceduralToolkit/Landscape Generator")]
public static void NewLandscapeGenerator()
{
var obj = new GameObject
{
name = "Landscape Generator"
};
Undo.RegisterCreatedObjectUndo(obj, "New Landscape Generator");
var terrainData = new TerrainData
{
heightmapResolution = 129,
size = new Vector3(1000, 1000, 1000)
};
var terrain = obj.AddComponent<Terrain>();
terrain.terrainData = terrainData;
terrain.materialTemplate = new Material(Shader.Find("Nature/Terrain/Standard"));
obj.AddComponent<TerrainCollider>().terrainData = terrainData;
var generator = obj.AddComponent<LandscapeGenerator>();
}
}
}