I’ve got an issue with destroy not existing in the current context. By script (C#) I create a gameobject and wish to destroy it. I’ve tried several approaches, trying to attach a script and then kill it through the script, like this:
public void kill()
{
Destroy (this);
}
called in the creating script via:
thing.GetComponent<killscript> ().kill ();
or in the script that created it like this:
Destory(thing);
The creating script is not a monobehavior but the script I’m trying to attach is. Nothing works, what am I missing?