You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Feel/MMTools/Editor/MMProcedural/MMTilemapGeneratorEditor.cs

40 lines
1.0 KiB
C#

3 months ago
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace MoreMountains.Tools
{
/// <summary>
/// Custom editor for the MMTilemapGenerator, handles generate button and reorderable layers
/// </summary>
[CustomEditor(typeof(MMTilemapGenerator), true)]
[CanEditMultipleObjects]
public class MMTilemapGeneratorEditor : Editor
{
protected MMReorderableList _list;
protected virtual void OnEnable()
{
_list = new MMReorderableList(serializedObject.FindProperty("Layers"));
_list.elementNameProperty = "Layer";
_list.elementDisplayType = MMReorderableList.ElementDisplayType.Expandable;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawPropertiesExcluding(serializedObject, "Layers");
EditorGUILayout.Space(10);
_list.DoLayoutList();
serializedObject.ApplyModifiedProperties();
if (GUILayout.Button("Generate"))
{
(target as MMTilemapGenerator).Generate();
}
}
}
}