Search Unity

Stopping animations

Discussion in 'Animation' started by Deleted User, Mar 21, 2021.

  1. Deleted User

    Deleted User

    Guest

    Hey all, I'm making an FPS game and am working on animations, I don't have a jump animation for my weapons so I'm just going to use my idle animation, what I've done is when the player click space, it plays the idle animation. The problem is that when I jump it only plays it for a second but doesnt finish until the player is on the ground. I've used
    Code (CSharp):
    1. if (Input.GetKeyDown(KeyCode.Space))
    2.         {
    3.             anim.SetBool("Run", false);
    4.         }
    5.         else
    6.         {
    7.             anim.SetBool("Run", true);
    8.         }
    And
    Code (CSharp):
    1. if (Input.GetKey(KeyCode.Space))
    2.         {
    3.             anim.SetBool("Run", false);
    4.         }
    5.         else
    6.         {
    7.             anim.SetBool("Run", true);
    8.         }
    But they don't make any difference, any solutions? Thanks in advance!