Hell. I am new to C# and am trying to build my first full game. I am trying to get an animation to play but am getting the same error “NullReferenceException: Object reference not set to an instance of an object axeAnimation.new & axeAnimation.update” here is the code. using UnityEngine;
using System.Collections;
public class axeAnimation : MonoBehaviour {
public GameObject axeGameObject;
Animator anim;
int swingHash = Animator.StringToHash(“swing”);
// Use this for initialization
void Start () {
anim.GetComponent ();
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Mouse0))
{
Debug.Log ("Test");
//18 \\ anim.SetTrigger("Default Take");
}
}
}
"
The error is on line 18 it says. Please help me out. ,