unity destory code example
Example 1: unity remove gameobject
// To remove a GameObject use the function 'Destroy()'
Destroy(gameObject);
Example 2: how to destroy a gameobject after some hits in unity 3d
void OnCollisionEnter(Collision YourGameobjectasAVarable) { if(YourGameobjectasAVarable.collider.tag == "YourGameObject'sTag") { //Whatever you want to happen, in your case you want it to be destroyed Destroy(//Your game object//*) }