Search Unity

Parameter 'Jump' does not exist

Discussion in 'Animation' started by Hoverr, Apr 4, 2020.

  1. Hoverr

    Hoverr

    Joined:
    Aug 7, 2018
    Posts:
    2
    Hey guys, I've been learning Unity for the past few days and I've encountered a problem. I set up a character, with a controller, collider and animation controller, the character moves and changes from idle to walk to running while it increases its speed. Also I added a jump animation when I left click on the mouse. Even though the animation plays, and my character jumps a little, the console sends the title of this post as a message. Parameter 'Jump' does not exist.



    And I can tell you the parameter exists, its created in the animation controller, and its properly called in the script, and the script even works!


    And a little bit of script


    I also tried changing 'animator' to 'GetComponent<Animator>()' to no avail.

    So I don't know what's causing this problem. I've restarted Unity a couple of times, I've renamed "Jump" a couple of times but it doesn't works. Restarted the animator tab. Nothing. What do you guys think it could be?
     
  2. lightbug14

    lightbug14

    Joined:
    Feb 3, 2018
    Posts:
    447
    Hi, Did you assigned the same animator controller to both characters (i see two characters in the image)? Maybe it's working for one character but no for the other (?).

    Also don't use bools for this, it's better to use triggers. Define the jump as a trigger "Jump" and do this (replace code from line 67 to 82 with this):
    Code (CSharp):
    1. if( Input.GetMouseButton(0))
    2.      animator.SetTrigger( "Jump" );
     
  3. Hoverr

    Hoverr

    Joined:
    Aug 7, 2018
    Posts:
    2
    Damn I'm dumb, I will be using trigger from now on, but as you suggested, the problem was with the other character. The second character didn't have a Jump bool but it did share the same code for movement, so whenever the code went to find "Jump" parameter it didn't find it :rolleyes:. Thanks a lot! This is solved now haha!