- Home /
 
 
               Question by 
               GamingNinjer · Jun 12, 2017 at 08:42 AM · 
                c#animationprogramming  
              
 
              Animation Not Playing When Animator Toggles on Bool Variables
Hello, I am working on a game and when I am working on the animations for movement the only animation I play is the Idle Animation, I have double checked and I don't see any errors with my code and so I was wondering if anyone knew what was possibly causing this.
*Code and Animator Picture Included Below using System.Collections; using System.Collections.Generic; using UnityEngine;
 public class PlayerMov : MonoBehaviour {
 
     // Use this for initialization
     void Start () {
     }
     
     // Update is called once per frame
     void Update () {
 
         Animator anim= GetComponent<Animator>();
         anim.SetBool("Moving", true);
 
         if (Input.GetKey(KeyCode.W))
         {
             this.transform.Translate(Vector3.forward*Time.deltaTime * 5);
             anim.SetBool("Moving", true);
         }
         else
         {
             anim.SetBool("Moving", false);
         }
         if (Input.GetKey(KeyCode.S))
         {
             this.transform.Translate(Vector3.back * Time.deltaTime);
             anim.SetBool("Backpedal", true);
            
         }
         else
         {
             anim.SetBool("Backpedal", false);
         }
     }
 }
 
 
               
 
                 
                capture.png 
                (41.0 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Should i create animations for different directions for a single animation? 0 Answers
How to resume animation where it left off? 3 Answers
My animation doesn't play! 1 Answer