MapGeneratorEditor.cs 490 B

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. using UnityEditor;
  3. [CustomEditor(typeof(MapGenerator))]
  4. public class MapGeneratorEditor : Editor
  5. {
  6. public override void OnInspectorGUI()
  7. {
  8. MapGenerator mapGen = (MapGenerator)target;
  9. if (DrawDefaultInspector())
  10. {
  11. if (mapGen.autoUpdate)
  12. {
  13. mapGen.DrawMapInEditor();
  14. }
  15. }
  16. if (GUILayout.Button("Generate"))
  17. {
  18. mapGen.DrawMapInEditor();
  19. }
  20. }
  21. }