4
votes

Steps taken:

  • Imported rigged/animated character (fbx file) from Blender(version 2.66a) into Unity(I believe the version I am using is 4.1.2; I know that I have downloaded/installed it within the last few days)
  • Checked 'Import Animation' in Animation settings in the Inspector
  • Created/tested animation clips in the Inspector
  • Dragged the character from the Asset panel to the Hierarchy panel

After dragging the character to the Hierarchy panel, I notice that I no longer see the animations when I select the character instance that is in the scene. If I run the game I receive the MissingComponentException referenced in the title.

In summary, I can see the animation in the import settings in the Inspector, but once I drag the character into the scene the animations disappear.

Here is my simple code to play the "idle" animation (which is named correctly and playing correctly in the import settings):

void Start () {
    animation.Play("Idle");     
}
2
Which version of Unity and Blender do you use? Do you have this problem with other models as well? Try exporting the character as FBXKay
The model is exported as FBX. I will update my post above with answers to your questions.Darren
Anything suspicious in editor log (I'm still 3.5 user, there it's reachable in console window)?Kay
All I see in the Console when I run the game is the error mentioned in the title. It actually appears as the very first thing. However, it does not stop the game from running.Darren

2 Answers

3
votes

There are two ways in Unity 4 to call a model's animations.

The "classic" way, like in Unity 3: By importing the fbx you have to set the "animation type" under "Rig" to "legacy." In the Hierachy the model needs the "Animation" component and NOT the "Animator" component! Then you have to add the animations from your model to the animation component. Now you can write

animation.Play("Idle");

The "new" Mechanim way: By importing the fbx you have to set the "animation type" under "Rig" to "generic." In the Hierachy the model needs the "Animatior" component and NOT the "Animaton" component! Then you have to add the animations from your model to the animation controller, which you add to your Animator component. In the controller you can set values to switch between different animations. But if you want to use Mechanim look at this tutorial, it helped me a lot!

http://www.youtube.com/watch?v=Xx21y9eJq1U

1
votes

In the Import Setting for the object, go to Rig and set the animation Type to Legacy.