Problem: Unity has no other way of nesting Animation Clips under Controllers. Such a fantastic way to keep folders full of Animation Clips organised but we have no way to do it right out of the box.
Nothing a new script with the help of some Googling can't fix. I took my first dive into EditorWindows this week to write up an implementation of nesting Animation Clips. It's simple, it's rough, to the more experienced of you out there it's probably ugly, but it works!
NestedAnimation.cs adds a set of options to the Assets/Create menu, these are available so long as an Animator Controller is selected. The Float, Int, Bool, and Trigger Animation options all quick create a new Animation Clip with a matching parameter of the selected type, a generic name (ex: "New Float"), and add a transition from "Any State" to the new clip. Custom Animation does all of the above and opens up a new window with some extra options: custom naming, speed setting, and a field for a speed multiplier parameter.
I stopped here in adding features as they currently satisfy my project's needs, however I hope to return to it in the future as well as creating a tool for deleting nested Animation Clips. In the meantime, I offer up NestedAnimation.cs for anyone to use and expand on with credit given. Find the full code below, or download a Unity Package here.



No comments:
Post a Comment