using UnityEngine; using System.Collections; public class DeleteTrigger : MonoBehaviour { void OnTriggerEnter (Collider other) { if (other == null || other.transform == null) return; Transform trans = other.transform; if (trans.parent != null) trans = trans.parent; Destroy(trans.gameObject); } }