Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active January 7, 2021 12:13
Show Gist options
  • Save todorok1/ad975b37223b40663b99ae257b06aadf to your computer and use it in GitHub Desktop.
Save todorok1/ad975b37223b40663b99ae257b06aadf to your computer and use it in GitHub Desktop.
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