Another guy who doesnt get the Destroy function to work.

So im currently chewing a bit on my problem tried various things like disabling scripts which might recreate obj and so on still doesnt work im getting a Null Reference Exception on line 22

using UnityEngine;

using System.Collections;

public class Attributes : MonoBehaviour {

	public int startingHealth = 100;

	void Update ()
		if (startingHealth == 0) {
			Debug.Log ("Destroy Call");
			DestroyObject (gameObject);

	public void Damage (int amount)
		startingHealth = startingHealth - amount;
		startingHealth = Mathf.Clamp (startingHealth, 0, 100);

		Debug.Log (startingHealth);



Your code seems to work fine. And @jgodfrey is correct about using Destroy() instead of DestroyObject(). But I just tried your code, attached it to an empty GameObject, ran the game and set startingHealth to 0 in the inspector and the GambObject was destroyed as expected with no errors.

Edit: Your problem is in the Attack class. You are trying to destroy the GameObject after it has already been destroyed.