// To remove a GameObject attached to this script instantly Destroy(gameObject); // To remove a GameObject attached to this script //in certain time (5 seconds for this example) Destroy(gameObject,5);