Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Animation will not play

Discussion in 'Animation' started by jhawkins308, Aug 10, 2018.

  1. jhawkins308

    jhawkins308

    Joined:
    Jun 16, 2018
    Posts:
    17
    Hey guys, I cannot get my run animation to play. It works and it plays just fine if I set it as the walk animation. It also works for both walk and run if I make both animations be the run animation. If anyone can help it would be much appreciated. Here is the code.

    void MoveTowards (Vector3 direction) {
    direction.y = 0;
    int speed = walkSpeed;
    animation.Play("deerwalk");



    if (walkInRandomDirection) {
    speed = randomSpeed;

    }

    if (executeBufferState) {
    speed = runSpeed;
    animation.Play("deerrun");
    }