using System; using UnityEngine; namespace Unity.AI.Navigation.Samples { /// /// Destroy GameObjects upon collision /// [RequireComponent(typeof(Collider))] public class Despawner : MonoBehaviour { void OnCollisionEnter(Collision collision) { Destroy(collision.gameObject); } } }