ETCAreaInspector.cs 778 B

123456789101112131415161718192021222324252627282930313233
  1. using UnityEngine;
  2. using UnityEditor;
  3. #if UNITY_5_3
  4. using UnityEditor.SceneManagement;
  5. #endif
  6. using System.Collections;
  7. [CustomEditor(typeof(ETCArea))]
  8. public class ETCAreaInspector : Editor {
  9. private ETCArea.AreaPreset preset = ETCArea.AreaPreset.Choose;
  10. public override void OnInspectorGUI(){
  11. ETCArea t = (ETCArea)target;
  12. t.show = ETCGuiTools.Toggle("Show at runtime",t.show,true);
  13. EditorGUILayout.Space();
  14. preset = (ETCArea.AreaPreset)EditorGUILayout.EnumPopup("Preset",preset );
  15. if (preset != ETCArea.AreaPreset.Choose){
  16. t.ApplyPreset( preset);
  17. preset = ETCArea.AreaPreset.Choose;
  18. }
  19. if (GUI.changed){
  20. EditorUtility.SetDirty(t);
  21. #if UNITY_5_3
  22. EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
  23. #endif
  24. }
  25. }
  26. }