Destroy Object on Collision (2D)

using UnityEngine;
using System.Collections;

public class  Destroy : MonoBehaviour {

    void OnCollisionEnter2D()
    {
        Destroy(gameObject);
    }
}


Destroy Object after set time

using UnityEngine;
using System.Collections;

public class DestroyObject : MonoBehaviour {

    public float time;
    void Start () {
    
        Destroy(gameObject,time);
    }
}