Hi, Is there other way to edit animation clips in Inspector other than drop down list?
Now, when I have 250+ clips, then I have to tediously and slowly wait for the list to scroll down and reveal that one animation I’m looking for? Any ideas? Thanks
I can think of a few (shitty) workarounds:
-
Pressing a letter key might jump you through the list to the first entry starting with that letter.
-
Make a separate Animator Controller to just put in the clips you want to edit. Or make a script that implements IAnimationClipSource so you can just throw them all in an array instead of needing to make lots of states and stuff.
-
It would probably be possible to do some editor scripting using reflection to access the animation window so you can make a better interface for it, but that would take a bunch of effort.
Thanks for the ideas!
1/ unfortunetly won’t work
2/ that’s interesting idea, thanks I’ll explore this
3/ oh no, but it would be perfect
Can resonate with this issue. It is brutal to find your callback function. Should have forward search matching.
Wat about having a nice tool with a tree-like controls, like the new Input System has?
Is there any asset that can help improve this inspector ? I have the same problem working on a pixel Art game and with all direction you have few hundreds animations to look into … Even just a scroll option would help a bit
I managed to create a custom editor window with buttons to select animation clips.
For my project, all I needed was:
1 get currently selected AnimatorController
2 get the path of folder where controller is
3 get all AnimationClips from that folder
4 display all in window
Below are my code snippets for inspiration
(1 - 3)
public static AnimationClip[] GetAllMotionsForController()
{
AnimatorController controller = GetCurrentController();
GetControllerInfo(controller, out string controllerPath, out string controllerFolder, out string controllerName);
return GetAllInstances<AnimationClip>(controllerFolder);
}
(1)
public static AnimatorController GetCurrentController()
{
AnimatorController controller = null;
EditorWindow[] tools = Resources.FindObjectsOfTypeAll<EditorWindow>();
int i;
int count = tools.Length;
for (i = 0; i < count; i++)
{
var toolType = tools[i].GetType();
var controllerProperty = toolType.GetProperty("animatorController", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
if (controllerProperty != null)
{
controller = controllerProperty.GetValue(tools[i], null) as AnimatorController;
return controller;
}
}
return null;
}
(2)
public static void GetControllerInfo(AnimatorController controller,
out string controllerPath, out string controllerFolder, out string controllerName)
{
controllerPath = AssetDatabase.GetAssetPath(controller);
controllerFolder = controllerPath.Substring(0, controllerPath.LastIndexOf('/'));
int controllerFullNameStart = controllerPath.LastIndexOf('/') + 1;
int controllerFullNameEnd = controllerPath.LastIndexOf('.');
string controllerFullName = controllerPath.Substring(controllerFullNameStart, controllerFullNameEnd - controllerFullNameStart);
controllerName = controllerFullName.Split("__")[0];
}
(3)
public static T[] GetAllInstances<T>(string parentFolder) where T : UnityEngine.Object
{
string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).Name, new[] { parentFolder });
T[] a = new T[guids.Length];
for (int i = 0; i < guids.Length; i++)
{
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
a[i] = AssetDatabase.LoadAssetAtPath<T>(path);
}
return a;
}
(4)
AnimationWindow animWin = EditorWindow.GetWindow<AnimationWindow>(false, "Animation", false);
AnimationClip[] motions = GlobalMethod.GetAllMotionsForController();
int count = motions.Length;
int i;
for (i = 0; i < count; i++)
{
if (PEGui.Button(motions[i].name, PELayout.V0, m_displayWidth, 18f))
animWin.animationClip = motions[i];
}
Thanks Kybernetik. “Make a separate Animator Controller to just put in the clips you want to edit.” Better than nothing! The current method of scrolling through a huge list is not suitable for numerous animations. Shame that ululbulul’s solution seems complicated and hard, as predicted.
Actually there’s another option now: if you can upgrade to Unity 2023 they finally got around to making context menus searchable and scrollable. I haven’t specifically checked this menu, but it seems like a global revamp of all menus so it should automatically apply here too.