using UnityEngine;
using System.Collections;

public class TimeToLive : MonoBehaviour {
    public float lifeTime = 5f;
    private float killTime;

    void Start() {
        killTime = Time.time + lifeTime;
    }

    void Update() {
        if (Time.time > killTime) {
            Destroy(gameObject);
        }
    }
}
