57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
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("增加0.5长度"))
|
|
{
|
|
_target.AddTargetLength(0.5f);
|
|
}
|
|
|
|
if (GUILayout.Button("减小0.5长度"))
|
|
{
|
|
_target.AddTargetLength(-0.5f);
|
|
}
|
|
|
|
if (GUILayout.Button("增加0.1长度"))
|
|
{
|
|
_target.AddTargetLength(0.1f);
|
|
}
|
|
|
|
if (GUILayout.Button("减小0.1长度"))
|
|
{
|
|
_target.AddTargetLength(-0.1f);
|
|
}
|
|
|
|
if (GUILayout.Button("增加0.01长度"))
|
|
{
|
|
_target.AddTargetLength(0.01f);
|
|
}
|
|
|
|
if (GUILayout.Button("减小0.01长度"))
|
|
{
|
|
_target.AddTargetLength(-0.01f);
|
|
}
|
|
|
|
|
|
if (GUILayout.Button("打印总长度"))
|
|
{
|
|
Debug.Log($"总长度={_target.GetCurrentLength()} 目标长度={_target.GetTargetLength()}");
|
|
}
|
|
// serializedObject.Update();
|
|
// EditorGUILayout.PropertyField(lookAtPoint);
|
|
// serializedObject.ApplyModifiedProperties();
|
|
}
|
|
} |