CapersProject/Packages/com.arongranberg.astar/Editor/AnimationLinkEditor.cs
2024-06-04 03:26:03 +09:00

24 lines
689 B
C#

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
namespace Pathfinding {
[CustomEditor(typeof(AnimationLink))]
public class AnimationLinkEditor : EditorBase {
protected override void Inspector () {
var script = target as AnimationLink;
EditorGUI.BeginDisabledGroup(script.EndTransform == null);
if (GUILayout.Button("Autoposition Endpoint")) {
List<Vector3> buffer = Pathfinding.Util.ListPool<Vector3>.Claim();
Vector3 endpos;
script.CalculateOffsets(buffer, out endpos);
script.EndTransform.position = endpos;
Pathfinding.Util.ListPool<Vector3>.Release(buffer);
}
EditorGUI.EndDisabledGroup();
base.Inspector();
}
}
}