using System.Collections; using System.Collections.Generic; using UnityEngine; public class ObjOffAfterTime : MonoBehaviour { [SerializeField] float time; private void OnEnable() { Invoke("ObjOff", time); } void ObjOff() { gameObject.SetActive(false); } }