The Stack Overflow podcast is back! Listen to an interview with our new CEO.

 2 deleted 194 characters in body edited Jul 7 '16 at 7:22 Daniel Netzer 55133 silver badges1313 bronze badges at the moment the loop that run the Jump animation is infinite because if (run == true) { // this condition is always TRUE once the player press R.  we can avoid it by changing that into a diffrent boolean that doesnt effect the running animation itself as I can only guess that when RUN equals TRUE the player is running so the following code should solve this problem. public bool run = false; public bool jump = false; void Start () {   } void Update () { if(Input.GetKey(KeyCode.R)) { run = true; jump = true } if (jump == true) {   GetComponent().Play("Jump"); GetComponent().wrapMode = WrapMode.Loop; jump == false; // now the player will run and jump one time after he press the key R.} } }  at the moment the loop that run the Jump animation is infinite because if (run == true) { // this condition is always TRUE once the player press R.  we can avoid it by changing that into a diffrent boolean that doesnt effect the running animation itself as I can only guess that when RUN equals TRUE the player is running so the following code should solve this problem. public bool run = false; public bool jump = false; void Start () {   } void Update () { if(Input.GetKey(KeyCode.R)) { run = true; jump = true } if (jump == true) {   GetComponent().Play("Jump"); GetComponent().wrapMode = WrapMode.Loop; jump == false; // now the player will run and jump one time after he press the key R. } }  at the moment the loop that run the Jump animation is infinite because if (run == true) { // this condition is always TRUE once the player press R.  we can avoid it by changing that into a diffrent boolean that doesnt effect the running animation itself as I can only guess that when RUN equals TRUE the player is running so the following code should solve this problem. public bool run = false; void Start () { } void Update () { if(Input.GetKey(KeyCode.R)) { run = true; GetComponent().Play("Jump"); GetComponent().wrapMode = WrapMode.Loop; } }  1 answered Jul 5 '16 at 14:42 Daniel Netzer 55133 silver badges1313 bronze badges at the moment the loop that run the Jump animation is infinite because if (run == true) { // this condition is always TRUE once the player press R.  we can avoid it by changing that into a diffrent boolean that doesnt effect the running animation itself as I can only guess that when RUN equals TRUE the player is running so the following code should solve this problem. public bool run = false; public bool jump = false; void Start () { } void Update () { if(Input.GetKey(KeyCode.R)) { run = true; jump = true } if (jump == true) { GetComponent().Play("Jump"); GetComponent().wrapMode = WrapMode.Loop; jump == false; // now the player will run and jump one time after he press the key R. } }