Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    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. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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");
    }