XRBoundLineEditor.cs 913 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace XRTool.WorldUI
  6. {
  7. [InitializeOnLoad]
  8. [CustomEditor(typeof(XRBoundLine))]
  9. public class XRBoundLineEditor : Editor
  10. {
  11. private SerializedProperty scaleType;
  12. private XRBoundLine line;
  13. private void OnEnable()
  14. {
  15. scaleType = serializedObject.FindProperty("scaleType");
  16. line = target as XRBoundLine;
  17. }
  18. public override void OnInspectorGUI()
  19. {
  20. base.OnInspectorGUI();
  21. EditorGUILayout.PropertyField(scaleType, new GUIContent("缩放模式"));
  22. serializedObject.ApplyModifiedProperties();
  23. if (GUI.changed)
  24. {
  25. if (line)
  26. {
  27. line.SetLine(line.transform.localScale);
  28. }
  29. }
  30. }
  31. }
  32. }