using System.Collections; using System.Collections.Generic; using UnityEngine; public class ParticalClash : MonoBehaviour { public float lifeTime = 2; private float time = 0; private void die(float time, float lifeTime){ if(time > lifeTime){ GameObject.Destroy(this.gameObject); } } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { time += Time.deltaTime; die(time, lifeTime); } }