Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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");
    }