Search Unity

How can I have 2 different transitions from one state in unity Animator

Discussion in '2D' started by Stark-12, Aug 8, 2022.

  1. Stark-12

    Stark-12

    Joined:
    Aug 31, 2021
    Posts:
    6
    When I try to jump while running , the jump animation dosen't start therefore the double jump animation
    but when I try to do it while standing still (idle mode) I can do the jump and double jump animation
    *I know my screenshot is very messy but sorry for that*
     

    Attached Files:

  2. Stark-12

    Stark-12

    Joined:
    Aug 31, 2021
    Posts:
    6
  3. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,465
    So you need to test out the Running to Jumping animation first. You said that it doesn't work and therefore the Double Jumping animation doesnt as well. Run your game in test mode in the editor and have the animator window open as well. Also, throw in some Debug.Logs in your code to see it in the console if the transition is too fast. Try to figure out what is (or isn't) happening when it is supposed to.

    Questions like, does Running to Jumping occur but it immediately goes to DoubleJumping which immediately goes to Idle? If Idle to Jumping works what are you doing there that you may be doing differently than Running to Jumping. etc.. Do a lot of testing and you should find out the issue.
     
  4. Stark-12

    Stark-12

    Joined:
    Aug 31, 2021
    Posts:
    6
    If I'm idle the jumping animation occurs and also the double jump animation works just fine
    but when I'm running and jump the code works fine to make the parameter true
    but the animation is never played​
     
  5. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,465
    So check your transitions and make sure that it isnt immediately going from Running > Jumping > Double J > Idle in a second. You may have to mess around with the HasExitTime and things of that nature. If your debug.logs are calling that shows that each animator change is happening, that is a good sign, now you need to find out why they are occuring so instantly.
     
    Stark-12 likes this.