Grettings! i have a problem with this code
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public int speed;
public float jumpV;
private bool isOnAir=false;
private bool walking;
Animator ani;
void FixedUpdate(){
float MoveF=Input.GetAxis("Horizontal");
Moves (MoveF);
jump ();
Animating (MoveF);
Debug.Log (walking);
}
void jump(){
if(Input.GetButton("Jump") && isOnAir==false){
GetComponent<Rigidbody>().AddForce(Vector3.up*jumpV);
isOnAir=true;
ani.SetBool("IsJumping",true);
}
}
void OnCollisionStay(Collision collisionInfo){
if (collisionInfo.gameObject.tag=="Walls") {
} else {
isOnAir = false;
}
}
void Moves(float h){
Vector3 Move = new Vector3 (h, 0, 0);
GetComponent<Rigidbody> ().MovePosition (transform.position+Move*speed*Time.deltaTime);
}
void Animating(float h){
if (h != 0f) {
walking = true;
} else {
walking=false;
}
ani.SetBool ("IsWalking", walking);
}
}
Im having this error: Assets/Scripts/PlayerController.cs(10,18): warning CS0649: Field PlayerController.ani' is never assigned to, and will always have its default value null’
Help me please!