Animation/Movement Error
Look at line 38 and 39. Can anyone find my problem?
using UnityEngine; using System.Collections;
 public class PlayerMovement : MonoBehaviour
 {
 
     public float moveSpeed;
     public float jumpHeight;
 
     private Animator anim;
 
     // Use this for initialization
     void Start()
     {
         anim = GetComponent<Animator>();
     }
 
     // Update is called once per frame
     void Update()
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             GetComponent<Rigidbody>().velocity = new Vector2(0, jumpHeight);
         }
             if (Input.GetKeyDown(KeyCode.D))
             {
                 GetComponent<Rigidbody>().velocity = new Vector2(moveSpeed, 0);
             }
 
         if (Input.GetKeyDown(KeyCode.A))
         {
             GetComponent<Rigidbody>().velocity = new Vector2(moveSpeed, 0);
         }
 
 
 
 
             anim.SetFloat("MoveX", Input.GetKeyDown(KeyCode.D)(Input.GetKeyDown.A));
             anim.SetFloat("MoveUp", Input.GetKeyDown(KeyCode.Space));
 
 
         }
     }
 
 
              Answer by Yoshinator2 · Nov 27, 2016 at 06:58 PM
I believe it is because you cannot send Input variables to the animator. Instead, make a simple if statement that will set a certain bool or variable to be true, or 1. Then send it to the animator. This should look something like this:
If(Input.GetKeyDown(KeyCode.D)(Input.GetKeyDown.A))
Your answer
 
             Follow this Question
Related Questions
My animation is working but the character won't move. 2 Answers
How to have a trigger activate animation on another game object. 2 Answers
how to modify the movement speed of a standard asset(thirdpersoncharacter) using other scripts? 1 Answer
Animation rigging doesnt work until I disable and re-enable Rig Builder 2 Answers