44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
#if UNITY_EDITOR
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace Northbound
|
|
{
|
|
[CustomEditor(typeof(ObstacleSpawner))]
|
|
public class ObstacleSpawnerEditor : UnityEditor.Editor
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
DrawDefaultInspector();
|
|
|
|
ObstacleSpawner spawner = (ObstacleSpawner)target;
|
|
|
|
EditorGUILayout.Space(10);
|
|
EditorGUILayout.LabelField("에디터 도구", EditorStyles.boldLabel);
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
|
|
if (GUILayout.Button("장애물 생성", GUILayout.Height(30)))
|
|
{
|
|
spawner.SpawnObstacles();
|
|
EditorUtility.SetDirty(spawner);
|
|
}
|
|
|
|
if (GUILayout.Button("장애물 제거", GUILayout.Height(30)))
|
|
{
|
|
spawner.ClearObstacles();
|
|
EditorUtility.SetDirty(spawner);
|
|
}
|
|
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.Space(5);
|
|
EditorGUILayout.HelpBox(
|
|
"• 장애물 생성: 설정한 밀도에 따라 랜덤 배치\n" +
|
|
"• 장애물 제거: 생성된 모든 장애물 삭제\n" +
|
|
"• Scene 뷰에서 초록색 영역이 배치 범위입니다",
|
|
MessageType.Info);
|
|
}
|
|
}
|
|
}
|
|
#endif |