void OnTriggerEnter2D(Collider2D other) { if (hits==null || keepAlive) return; foreach (System.Type t in hits){ if (other.GetComponent(t) != null) { if (destroyOnHit) Destroy(destroyOnHit); else Destroy(gameObject);break; } } }