Unable to use Maya animation with scripts when imported to Unity

Posted by keshk on Game Development See other posts from Game Development or by keshk
Published on 2014-06-06T23:37:55Z Indexed on 2014/06/07 3:49 UTC
Read the original article Hit count: 260

Filed under:
|
|

I am testing to import Maya animation over to Unity. I set up a simple cylinder with 2 bones and an IK handle. Made a simple animation where the cylinder bends and goes back to straight position over 24 frames.

Following that, I selected everything and baked, all bones,ik,(animation by selecting all at the graph editor) and even the cylinder. I saved the scene and then select all and export as FBX with animation and bake checked.

In unity imported it and at the preview able to see the animation. When I load the model into scene and play (after assigning the controller), able to see animation too.

But now when I try to script it and control the animation, nothing happens. Even to test, I tried the following under the Update method.

if(animation.isPlaying)
    Debug.Log("Animation Works");
else
   Debug.Log("Animation not working"); 

The bool doesn't even return true nor false. My animation is called "bend", thus just for try I did the following and nothing happens.

animation.Play("bend");

Can please advice based on my steps, am I missing something. Do I need to add the controller or is that an unnecessary step? Did I screw up on the Maya part or the Unity part. Thanks for help.

© Game Development or respective owner

Related posts about c#

Related posts about unity