Animation Clips (25296)

Is there a way to create Animation Clips via either JavaScript/C#? If not, is there a way to “tag” animation in Maya so it appears as an animation clip when imported into Unity?

Thanks,
Grant

2 Answers

2

I’m not a Maya user but I’m quite sure it has an fbx exporter that has the option to export animations with it, just make sure animations are checked in the export options. Also make sure Unity is set to import the animations, this can be checked by clicking the imported fbx (prefab) and look at the animations tab. Set “Generation” to anything but “Don’t import” and you should get your animation clips

hope this helps :wink:

The good thing is the curves are coming in fine. With Maya, all you have to do is include your Maya scene (.ma file) in your Unity project folder and it the importing is seamless. No need to export FBX files as it's all done on the fly. Since all the animation comes over as just animation, it still needs to be broken up into clips. That I can do in Unity but I was wondering if there was a more automatic way to make this work. I am trying to avoid having my developers rebuild the clips every time an animation change is made by an artist.

–

Surely somewhere youbare going to have to define whichbframes are which named clip, as you do in the Unity importer fields. What else could you do in script? (if there is something better, Unity should be doing it).

–

Sure. What I was not sure is if/how to define the animation curve ranges as clips on the Maya side for automatic creation on the Unity side. One way would be a built-in tool like the "track editor" in Maya (which I have not had time to test). The other thought was (a little more pipeline like) to write a simple tool on the Maya side that would export a "config" script in JS or C# that would set the clip values at runtime. It's not ideal but I assume there is a way to do this. Grant

–

The example at: http://unity3d.com/support/documentation/ScriptReference/AnimationClip.SetCurve.html shows how to create an animation clip in code.

Graham, thanks for the lead to the code. I will definitely help out with some of the things I am trying to do. Grant

–