NullReferenceException error

Im currently working on a code where i fire a bullet to hit some targets, i’ve attached a rigidbody and collider on the bullet.
and colliders on all the targets. the following script is attached to the bullet so when the bullet hits any target will return message to OnTriggerEnter. but im having a nullreferenceexception and i cant figure out for the life of me where i went wrong.

“NullReferenceException: Object reference not set to an instance of an object
RemoveBullet.OnTriggerEnter (UnityEngine.Collider other)”

    public Halfs _half;
	private float time = 2.0f;
	private int movespeed = 2000;
	void Awake(){
		collider.enabled = true;
		Destroy(gameObject, time);
	void Update(){
		transform.Translate(Vector3.forward * Time.deltaTime * movespeed);
	void OnTriggerEnter(Collider other) {
    	if( other.gameObject.tag == "Target"  ) {
			//hit a target
			Debug.Log ("Bullet has hit a target");
			_half.JustGotShot(1); // message to target  <-- this line is where im getting the error from.
			Destroy(gameObject); //destroy bullet

One thing that might help is to make sure it can find the game object. It’s possible it may not exist or it cannot find it.
Use something like this:

variable = GameObject.FindGameObjectWithTag("Target");
Debug.Log("variable "+variable);
    Debug.Log("Could not find the object");

Also, make sure that you actually have a tag called target and the target game object is set to that tag.
Hope that helps…

Either _halfs wasn’t assigned or the object it’s referencing was destroyed. You should test if it’s different from null before using it. Is Halfs inheriting from MonoBehaviour ? If so, don’t forget to assign the value in the inspector.