using UnityEngine; using System.Collections; public class TrashDespawner : MonoBehaviour { // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { } private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Enemy")) { Destroy(collision.gameObject); } } // Update is called once per frame void Update() { } }