Selecting Animation Clips

Ok… in Unity 1.6.2, what I’m trying to do is select all the animation clips that exist in the project view (or better still all the animation clips of the selected gameObjects in the project view). This is so that I can easily grab them all at once in order to drag/attach them to another gameObject. We have several different characters that all share the same animation files, but all except the character with the animation name doesn’t link the animations (using charname@anim).

I’ve tried using Selection.GetFiltered(Animation, SelectionMode.Unfiltered) but I cannot assign that to a variable or add that to an array, and if I try to set Selection.objects equal to it then I only get the last animation of all previously selected items.

I’ve also tried going through gameObject.component for the selection, but because nothing is in the scene, only the project view (nothing is instantiated yet), it won’t let me access gameObject because there is none.

I’ve tried… I’m still trying… but I can’t seem to figure it out… please help! :slight_smile: Can this even be done staying in the project view, or does any such scripting have to happen in the scene view? Thanks.

Well… thanks to a start from me and a lot of making it work with the correct commands and nomenclature from one of our programmers, I have a working script. It’s an Editor script so place it in your project/Assets/Editor folder and you can access it from the GameObjects menu or with Command+Shift+A.

I’m attaching it in case it’s useful to anyone else. Could be handy to anyone using multiple characters with shared individual animation clip files (or just me because I’m dense and don’t know another way to do this yet :slight_smile: ).

What it will do is take a skinned character mesh (or prefab that mesh has been added into) that exists in the Scene view and assign all the animations that you currently have selected in the Project or Scene view to it.

**You have to edit the script to change the goNameName variable to match the mesh/prefab name you’re adding the animations to.

55473–2027–$assignselectedanimationclips_106.js (1.48 KB)

I tried installing this script by copying it into my project assets/scripts dir and copying the unityeditor.dll into my project plugins directory.
(from /Applications/Unity/Unity/Contents/Frameworks/UnityEditor.dll)

Even though the script compiles properly, I don’t see the new menu option under GameObject.
(AssignSelectedAnimationClips)

Any ideas?

Okay, all I had to do was put the script in the assets/Editor folder and it works. :slight_smile:

Just found this script and wanted to say thanks to Greymarch for providing it. I had a ton of various animations to add into several characters and this made the job easy as can be.

I’m very glad that other people have also found it useful :smile:

Helped us out a lot.