SplineHandleInspector.cs 424 B

12345678910111213141516171819
  1. using UnityEditor;
  2. using UnityEngine;
  3. [CustomEditor(typeof(SplineHandle))]
  4. class SplineHandleInspector : Editor
  5. {
  6. public override void OnInspectorGUI()
  7. {
  8. SplineHandle handle = (SplineHandle)target;
  9. if (handle.Opposite != null && GUILayout.Button("Snap to axis"))
  10. {
  11. handle.SnapOppositeToAxis();
  12. }
  13. if (GUI.changed) { EditorUtility.SetDirty(handle); }
  14. }
  15. }