TC_Area2DEditor.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4. namespace TerrainComposer2
  5. {
  6. [CustomEditor(typeof(TC_Area2D), true)]
  7. [CanEditMultipleObjects]
  8. public class TC_Area2DEditor : Editor
  9. {
  10. SerializedProperty terrainAreas;
  11. void OnEnable()
  12. {
  13. Transform t = ((MonoBehaviour)target).transform;
  14. t.hideFlags = HideFlags.NotEditable | HideFlags.HideInInspector;
  15. terrainAreas = serializedObject.FindProperty("terrainAreas");
  16. }
  17. public override void OnInspectorGUI()
  18. {
  19. if (TC_Settings.instance == null) return;
  20. serializedObject.Update();
  21. if (TC_Settings.instance.debugMode) DrawDefaultInspector(); else DrawCustomInspector();
  22. serializedObject.ApplyModifiedProperties();
  23. }
  24. void DrawCustomInspector()
  25. {
  26. // TD.DrawSpacer();
  27. // TD.DrawLabelWidthUnderline("Area 2D script", 14);
  28. TD.DrawSpacer();
  29. TD.DrawPropertyArray(terrainAreas);
  30. TD.DrawSpacer();
  31. // TD.DrawProperty(terrainLayer);
  32. }
  33. }
  34. }