Search Unity

  1. Unity 2018.3 is now released.
    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. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    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:
    10
    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");
    }