-
-
Save todorok1/ad975b37223b40663b99ae257b06aadf to your computer and use it in GitHub Desktop.
TerrainのHeightMapを生成するスクリプト(エディタ拡張のクラス)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
/// <Summary> | |
/// エディタ上でTerrainのHeightMapを生成するクラスです。 | |
/// </Summary> | |
[CustomEditor(typeof(TerrainGenerator))] | |
public class TerrainGeneratorEditor : Editor | |
{ | |
public override void OnInspectorGUI() | |
{ | |
var generator = target as TerrainGenerator; | |
DrawDefaultInspector(); | |
EditorGUILayout.Space(); | |
if (GUILayout.Button("フィールドの生成")) | |
{ | |
GenerateTerrainOnEditor(generator); | |
} | |
EditorGUILayout.Space(); | |
if (GUILayout.Button("リセット")) | |
{ | |
ResetHeightMap(generator); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment