Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TerrainのHeightMapを生成するスクリプト(エディタ拡張のクラス)
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