Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to import character from Mixamo with animations

Discussion in 'Scripting' started by gdennis, Jan 2, 2015.

  1. gdennis

    gdennis

    Joined:
    Oct 22, 2014
    Posts:
    17
    I am in desperate need of a way to import a free character from maximo with the walking and idle animation.

    I have been trying for 2 days in a row now trying to get this to work but I just cannot do it.

    What I want is the following:

    I want to download 8 free character models from Mixamo (example this one: https://www.mixamo.com/editor/new/gm115510901?character_id=122137) and get the 'walking' and 'idle' animation (maybe later I might want more, but for now I just need these). I noticed I can get these animations from https://www.mixamo.com/motions. I then download these for Unity (.fbx) with 60FPS. And I try to import them as a new asset into my unity project.

    When I then drag the character onto the scene I want to be able to do in code the following:

    Code (CSharp):
    1. npcObj.GetComponent<Animation>().animation.Play("npcidle");
    and

    Code (CSharp):
    1. npcObj.GetComponent<Animation>().animation.Play("npcwalking");

    I duplicated the 'walking' and 'idle' animation from models I downloaded already, and when I add an Animation component to the newly downloaded models and put these animations in. They just don't work at all. The character stays in it's T-position.

    What am I doing wrong? Is the 'method' I am using completely wrong, and is there an easier way to do what I want?

    If the question is unclear please do not hesitate to ask for further clarification. This is very important to my 'game' and I am getting desperate!


    PS: the character example I gave here https://www.mixamo.com/editor/new/gm115510901?character_id=122137 also seems to be very buggy when I directly place it onto the scene. It looks awful! However, the two other ones I tried look perfect! So I don't know if it's something I am doing wrong or if it's because of Mixamo (in the Mixamo editor it looks perfect though...)

    Kind regards,
    Dennis
     
  2. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    When you import a 3D model, specifically character - it'll either be in Legacy animations mode or Humanoid. Legacy animation can be used with the "Animation" component while Humanoid and 2 other modes has to be used in "Animator" component. I am not experience full with Animator, so I can't help you there. But if you click on the 3D model you've downloaded on your Project tab, then it should be a new window in Inspector. There, it should say something like "Import: Humanoid" or "Import: Legacy". Something like that, you should be able to click the button in order to be able to choose other modes. Click on Legacy and then add the animation to your character in the "Hierarchy" tab. Then in scripting, do like this:
    Code (CSharp):
    1. animation.Play("npcidle");
     
  3. gdennis

    gdennis

    Joined:
    Oct 22, 2014
    Posts:
    17
    Thank you, this worked!!!
     
  4. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    You are more than welcome! Feel free to ask if you ever need help again! :)