Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active January 7, 2021 12:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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