using System.Collections; using System.Collections.Generic; using UnityEngine; public class GunController : MonoBehaviour, IPooledObject{ // Start is called before the first frame update public void OnObjectSpawn(){ StartCoroutine(Remove()); } IEnumerator Remove(){ yield return new WaitForSeconds(12f); gameObject.SetActive(false); } void OnTriggerEnter2D(Collider2D col){ if(col.gameObject.tag == "Player"){ gameObject.SetActive(false); } } }