Search Unity

I can only make one walking animation play for all directions (2d)

Discussion in 'Animation' started by LordLemonhead, May 31, 2021.

  1. LordLemonhead

    LordLemonhead

    Joined:
    May 31, 2021
    Posts:
    3
    Hello,

    I just started getting into Unity by watching and following tutorials. So far it has been going great. I just reworked my sprite and started working on animations. Following a tutorial I created my animations and build an idle blend tree and a walking blend tree. So far I made one idle animation ( so idk if that would have the same issue) and two walking animations for left and right. They are both individual so there was no need for me to flip them in unity. In the animation window the seemed to work properly and I checked again if everything was correct. However now that I've created motion fields for each of them (and put in one positive and one negative position number) I get to see the same animation, no matter if I press left or right. As I found out it depends on which one is on top? If the walking_left animation is the top motion field my sprite walks left only, no matter which direction I click. If walking_right is on top it's the same but with that animation instead.

    So they both seem to work just fine but I cannot figure out how to make them both play in the same setting.

    Maybe anyone can help?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    You've made a mistake in your setup somewhere, but we can't tell you what's wrong without seeing any of your code or Animator Controller.

    But you might be interested in Animancer (link in my signature) which is an alternative animation system that lets you control everything in code instead of using Animator Controllers. It has Directional Animation Sets which make it much easier to set up animations in groups of up/right/down/left because all you have to do is drag the 4 animations you want into the corresponding Inspector fields instead of repeating the same Blend Tree setup all the time. The Directional Animations examples explain how to use them. Animancer Lite is free and for a sprite based game you might not even need any of the pro-only features.