Search Unity

Animations with the Animator not working

Discussion in 'Animation' started by Xialya, Oct 9, 2015.

  1. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    52
    Hello,

    I'm new to Unity, and running into an issue. I was already following a couple of tutorials, but looks like there's an issue i cannot fix after hours spent on it:

    My character (an animated rat purchased on the Asset Store) has an animator controller with the different animations that are set properly with transitions and parameters. But in-game, the animations don't run. As you can see on the provided screenshot, the animations run in the Animator, but not in-game. I tried to switch between different default animations, parameters, and variables. None of the animations are working in-game.

    However, when I put, say the Rat_Walk animation, as an Animation Clip on the Player, the animation plays in-game. But that's not what I need.



    I later found out there's no Motion (on the right), and I cannot set it to any of the Rat animations. I can set it to any other animation though. Even the Take 001 animation that came with the rat, which is grouping all 5 rat animations. If I set this one, then it works, but playing the Take 001 clip, not the individual ones. Still not what is wanted here.

    So, would this issue be related to the animations themselves? How to fix it?

     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Based on the images this rat is going to be player controlled?
    If that is so - look into the animation part of the learn section. Your doing some of the steps, but not all of them. The answers you seek are there.
    And unless you are preforming advanced animation techniques - you don't want to have an animator and an animation component on the rat. You will want to remove one or the other.
     
  3. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    52
    Yes, the rat is player controlled.
    I was following a tutorial again, but to no avail.
    It is working on other models though.
    What seems to be missing to work, is the clip in the Motion field.
     
  4. solkar

    solkar

    Joined:
    Aug 15, 2012
    Posts:
    38
    Have you linked input to Animator parameters? I see some parameters in the Animator window but the should be tied to the controls.

    And yes, you have to assign an animation clip to each state in the Animator window.
     
  5. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    52
    Yes, input are linked, and working. The different animation states are running, as mentioned, but no animations.

    I noticed something else.
    When I select one of the animations in the Animator, there is no animation displayed below.



    Whereas with the spider model, its animations, and the animator I set for it; animations are properly displayed below.



    What could be causing this?
    I am clueless.
     
  6. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    In the inspector with rat idle2 selected in the motion field - there is none (motion). Place the idle2 animation into that field.
     
  7. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    52
    As I said in my first post above, I can place any other animation in the motion field, except those coming with the animated rat.
    Outside of that, they work if I put them as an animation clip. But this is not what is expected here.
     
  8. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    The separate animations were generated from the original Take 001 correct?

    If you duplicate the idle2 animation can you then assign the duplicated animation to the motion field?
     
  9. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    52
    I cannot duplicate them.
    They come as follows:

     
  10. Will-Kingsley

    Will-Kingsley

    Joined:
    May 29, 2014
    Posts:
    2
    Did you ever figure this out? I'm experiencing the same issue.
     
  11. Obaid1122

    Obaid1122

    Joined:
    Aug 10, 2017
    Posts:
    1
    select your rat model and click the rig part on the center tab in the inspector, change the animation type to humanoid, then drop animation into the state machine it will work fine :)
     
    Last edited: Sep 7, 2017
    kashifali likes this.
  12. Deveesh

    Deveesh

    Joined:
    Oct 25, 2015
    Posts:
    2
    GOT IT
    Do this:
    Go to your animator controller -> open your animator controller asset(state machine) -> click on every animation and look at the inspector -> in the "motion" field drag your animation clip. Do this for all the animations. Hope it helps :D
     
    MrAsadjaved likes this.
  13. AnoyRC

    AnoyRC

    Joined:
    Oct 21, 2017
    Posts:
    2
    Hey!! 100% working !! go to the model and animation in the asset browser and change the rig to generic..It will surely work
     
  14. tfunk

    tfunk

    Joined:
    Jul 31, 2014
    Posts:
    2
    Wanted to chime in here as I finally noticed that my issue wasn't that the animations weren't applying, but that the changes weren't being rendered due to static batching being turned on. I'm not sure what other sort of workaround there is to this, but I went to Edit -> Project Settings -> Player -> Other Settings and unchecked Static Batching and voila! Right as rain.
     
    Bailey_Prowse likes this.
  15. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    I highly doubt static batching has anything to do with OPs issue. Most likely the animations were simply the wrong type. The first screenshot shows them in the legacy Animation component which means the animations are probably set to legacy. But legacy animations cannot be used in an Animator Controller so they simply won't work.

    And they should never have had both an Animation and Animator component on the same object. You can't use two entirely different animation systems at the same time.
     
  16. MrAsadjaved

    MrAsadjaved

    Joined:
    Mar 28, 2015
    Posts:
    2
    Thanks, This was the solution for me.
     
  17. mikedamanskis

    mikedamanskis

    Joined:
    Jul 23, 2019
    Posts:
    4
    Thank you! This fixed the issue for me. I could not understand why my simple door open animation wasn't working and spent about 2 hours trying to figure it out. Once I unchecked Static Batching, it worked perfectly!
     
  18. notActual_dev

    notActual_dev

    Joined:
    Oct 8, 2019
    Posts:
    2
    Go to ANIMATOR component -> right click -> click on OPTIMIZE TRANSFORM HIERARCHY.
    I don't know how it works but it works!
     
  19. joaobaltieri

    joaobaltieri

    Joined:
    Nov 8, 2015
    Posts:
    4
    Worked for me! DEOPTIMIZE HIERARCHY
     
  20. kashifali

    kashifali

    Joined:
    Jun 1, 2017
    Posts:
    1
    It work for me