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 buffer = Pathfinding.Util.ListPool.Claim(); Vector3 endpos; script.CalculateOffsets(buffer, out endpos); script.EndTransform.position = endpos; Pathfinding.Util.ListPool.Release(buffer); } EditorGUI.EndDisabledGroup(); } } }