# Unity3d - Do I need to destroy gameobject AND script?

From proper leak protection do I need to delete both of these or will getting rid of one take care of both?

Currently I am destroying the script AND the gameobject

private void OnDestroy() {
Destroy(this.gameObject);
Destroy(this);
}

• I don't see why you would need this in the first place .. OnDestroy is called anyway when the component already gets destroyed .. so why do you think you have to destroy it again? – derHugo Aug 18 '18 at 4:56
• The rest depends on what you need .. sometimes you only want to remove one component .. something you want to remove the entire GameObject.. – derHugo Aug 18 '18 at 5:06

By destroying the GameObject (Destroy(this.gameObject);), you also destroy the script (Destroy(this)) automatically.
But there is an issue with your code. OnDestroy() is called when the component is being destroyed. (This could be because the component is destroyed, or its GameObject.) So calling the code in there is probably not what you want.