I don't think that my Destroy(this) function is working properly, here's the script
using UnityEngine;
using System.Collections;
public class NpcHandler : MonoBehaviour {
public string npcName;
public int npcLevel;
public int npcExpWorth;
public int npcCurrHealth, npcMaxHealth;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(npcCurrHealth < 1) {
Destroy(this);
}
}
}
Now, once he runs out of health the other scripts can no longer reference from it, although the object stays there and the scripts are still attempting to reference, not sure what's going on here.
Yes, the script is attatched directly to the game object.
↧