using UnityEngine;

public class HasLifeTime : MonoBehaviour
{
    [SerializeField] private float LifeTime = 2;
    private float time;

    void Update()
    {
        time += Time.deltaTime;
        if (time > LifeTime) GameObject.Destroy(gameObject);
    }
}
