1
\$\begingroup\$

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 enter image description here

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.

\$\endgroup\$
1
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ after giving the animator control stills its not working \$\endgroup\$ – user1509674 Sep 16 '14 at 5:29
  • 1
    \$\begingroup\$ "still not working" could mean anything, what have you done and what is happening \$\endgroup\$ – jhocking Sep 16 '14 at 5:32
  • \$\begingroup\$ 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 \$\endgroup\$ – user1509674 Sep 16 '14 at 6:26
  • \$\begingroup\$ 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. \$\endgroup\$ – jhocking Sep 16 '14 at 8:35
  • \$\begingroup\$ No the code which i specified.I have setup the animation state in the animator controller.But still its not working. \$\endgroup\$ – user1509674 Sep 16 '14 at 11:56
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.