using UnityEngine; using System.Collections; public class SelfDestroy : MonoBehaviour { private float startTime; public float Delay = 1; // Use this for initialization void Start () { startTime = Time.time; } // Update is called once per frame void Update () { if (Time.time >= startTime + Delay) { Destroy(gameObject); } } }