# animation control problem

I have a list of .FBX object.When I drag that .FBX into scene its corresponding inspector Animation component(fig 1) appears but when I drag some other .FBX object into the scene the Animator component(fig 2) is getting added to the scene.Please see the image attached

Issues Found : 1)fig (1) - When we click on the object and write code to display animation

void OnMouseEnter()
{
animation.Play("DropBothFork01");
}


The above code is working But if we consider fig(2) the code is not working even though adding a animation component.

What will be the issue?Why for each .fbx object when drag into scene the animation and animator component varries.Could you please help me out solving it.

The short answer is that you don't have an animator controller on that object (note the 'None' in the Controller slot.)

The long answer is... kinda long. Read my answer here, how to setup an Animation Controller: Unable to use Maya animation with scripts when imported to Unity

• after giving the animator control stills its not working – user1509674 Sep 16 '14 at 5:29
• "still not working" could mean anything, what have you done and what is happening – jhocking Sep 16 '14 at 5:32
• I have added the controller to the Animator component and written the above code.When i click the space bar the correspondent animation is not getting played.Instead it is continuously playing the animation – user1509674 Sep 16 '14 at 6:26
• First off, by "the above code" do you mean code from the link I gave? Because I haven't posted any code here. Second, the behavior you describe is most likely because you didn't setup animation states correctly in the animator controller, and I have no idea what you did there. – jhocking Sep 16 '14 at 8:35
• No the code which i specified.I have setup the animation state in the animator controller.But still its not working. – user1509674 Sep 16 '14 at 11:56

Fig1 has the animation that you call in your code.

Fig2 has an animator component but no animation, this may explain the problem. try replacing the animator with your animation you want to run then call it in the same way you do in the code related to Fig1.

This is likely something not quite right with the fbx / prefab that contains it.