You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
694 B

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
namespace Pathfinding {
[CustomEditor(typeof(AnimationLink))]
public class AnimationLinkEditor : Editor {
public override void OnInspectorGUI () {
DrawDefaultInspector();
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();
}
}
}