FollowCameraInspector.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using UnityEngine;
  2. #if UNITY_EDITOR
  3. using UnityEditor;
  4. #endif
  5. namespace XRTool.Util
  6. {
  7. [InitializeOnLoad]
  8. [CustomEditor(typeof(followCamera))]
  9. public class FollowCameraInspector : Editor
  10. {
  11. /// <summary>
  12. /// 显示距离
  13. /// </summary>
  14. public SerializedProperty dicCount;
  15. /// <summary>
  16. /// 最高跟随Y轴
  17. /// </summary>
  18. public SerializedProperty PDISTANCEY;
  19. /// <summary>
  20. /// 最低跟随Y轴
  21. /// </summary>
  22. public SerializedProperty PDISTANCEYY;
  23. /// <summary>
  24. /// 旋转角度
  25. /// </summary>
  26. public SerializedProperty DISTANCE;
  27. private void OnEnable()
  28. {
  29. dicCount = serializedObject.FindProperty("_dicCount");
  30. PDISTANCEY = serializedObject.FindProperty("PDISTANCEY");
  31. PDISTANCEYY = serializedObject.FindProperty("PDISTANCEYY");
  32. DISTANCE = serializedObject.FindProperty("DISTANCE");
  33. }
  34. public override void OnInspectorGUI()
  35. {
  36. serializedObject.Update();
  37. // base.OnInspectorGUI();
  38. EditorGUILayout.PropertyField(dicCount, new GUIContent("显示距离"));
  39. EditorGUILayout.PropertyField(DISTANCE, new GUIContent("旋转角度"));
  40. EditorGUILayout.PropertyField(PDISTANCEY, new GUIContent("最高跟随Y轴"));
  41. EditorGUILayout.PropertyField(PDISTANCEYY, new GUIContent("最低跟随Y轴"));
  42. serializedObject.ApplyModifiedProperties();
  43. }
  44. }
  45. }