From 8722a9920c1f6119bf6e769cba270e63097f8e25 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 23 May 2024 10:08:29 +0800 Subject: + astar project --- .../Editor/AnimationLinkEditor.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Editor/AnimationLinkEditor.cs (limited to 'Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Editor/AnimationLinkEditor.cs') diff --git a/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Editor/AnimationLinkEditor.cs b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Editor/AnimationLinkEditor.cs new file mode 100644 index 0000000..1d7d71a --- /dev/null +++ b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Editor/AnimationLinkEditor.cs @@ -0,0 +1,23 @@ +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 buffer = Pathfinding.Util.ListPool.Claim(); + Vector3 endpos; + script.CalculateOffsets(buffer, out endpos); + script.EndTransform.position = endpos; + Pathfinding.Util.ListPool.Release(buffer); + } + EditorGUI.EndDisabledGroup(); + base.Inspector(); + } + } +} -- cgit v1.1-26-g67d0