I have a simple script which I took from this tutorial.
Our scripts are the same at 17:55. But for me, inputH and inputV are not recognized.
This is strange because it worked fine when I used the UnityChan file used in the video but it doesn’t work with my own mesh. I’ve compared the scripts over and over and can see nothing wrong.
I can’t use any turn or strafe animations until I can get this to work.
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public Animator anim;
public Rigidbody rbody;
private float inputH;
private float inputV;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator>();
rbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown("1"))
{
anim.Play("Walk_Blocking", -1, 0F);
}
inputH = Input.GetAxis("Horizontal");
inputV = Input.GetAxis("Vertical");
anim.SetFloat("inputH",inputH);
anim.SetFloat("inputV",inputV);
}
}
Please help!