using UnityEditor; using UnityEngine; [CustomEditor(typeof(Rope))] public class RopeFishLineEditor : Editor { private Rope _target; void OnEnable() { _target = target as Rope; // lookAtPoint = serializedObject.FindProperty("lookAtPoint"); } public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("打印总长度")) { Debug.Log($"总长度={_target.GetCurrentLength()} 目标长度={_target.GetTargetLength()} smoot={_target.GetLengthSmoothVel()} relLen={_target.GetLengthByPoints()}"); } // serializedObject.Update(); // EditorGUILayout.PropertyField(lookAtPoint); // serializedObject.ApplyModifiedProperties(); } }