The Stack Overflow podcast is back! Listen to an interview with our new CEO.
2 deleted 194 characters in body
source | link

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<Animation>().Play("Jump");
        GetComponent<Animation>().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<Animation>().Play("Jump");
      GetComponent<Animation>().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<Animation>().Play("Jump");
        GetComponent<Animation>().wrapMode = WrapMode.Loop;
        }
    }
1
source | link

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<Animation>().Play("Jump");
      GetComponent<Animation>().wrapMode = WrapMode.Loop;
      jump == false; // now the player will run and jump one time after he press the key R.
    }

}