my script : public class Move : MonoBehaviour {
public CharacterController CC;
public Animator Ani;
float MoveSpeed;
float TurnSpeed;
Vector3 V3;
// Use this for initialization
void Start () {
MoveSpeed = 5f;
TurnSpeed = 2f;
}
// Update is called once per frame
void Update () {
V3 = new Vector3 (0, Input.GetAxis ("Mouse X"), 0);
transform.Rotate (V3 * TurnSpeed);
Ani.SetBool ("walk", false);
if (Input.GetKey (KeyCode.W)) {
CC.Move(transform.forward * MoveSpeed * Time.deltaTime);
Ani.SetBool ("walk", true);
}
if (Input.GetKey (KeyCode.A)) {
CC.Move(transform.right * -1f * MoveSpeed * Time.deltaTime);
Ani.SetBool ("walk", true);
}
if (Input.GetKey (KeyCode.S)) {
CC.Move(transform.forward * -1f * MoveSpeed * Time.deltaTime);
Ani.SetBool ("walk", true);
}
if (Input.GetKey (KeyCode.D)) {
CC.Move(transform.right * MoveSpeed * Time.deltaTime);
Ani.SetBool ("walk", true);
}
}
}
UnassignedReferenceException: The variable Ani of Move has not been assigned.
You probably need to assign the Ani variable of the Move script in the inspector.
UnityEngine.Animator.SetBool (System.String name, Boolean value) (at C:/buildslave/unity/build/artifacts/generated/common/modules/AnimatorBindings.gen.cs:270)
Move.Update () (at Assets/Scripts/M