void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag != "ai" && collision.gameObject.tag != "aibullet" && collision.gameObject.tag != "wall") { Destroy(gameObject); move movecomponent = collision.gameObject.GetComponent <move>(); if (movecomponent == null) { Destroy(collision.gameObject); } else { movecomponent.damage(attack); } } }