using System.Collections; using System.Collections.Generic; using UnityEngine; public class TestDestroySelf : MonoBehaviour { public float lifeTime; void Start() { Invoke("DestroySelf", lifeTime); } void DestroySelf() { this.gameObject.SetActive(false); Destroy(this.gameObject); } }