private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.GetComponent <Shooting>() == shooter) { return; } var damageable = other.gameObject.GetComponent <Damageable>(); if (damageable != null) { damageable.GetDamage(); } else if (explosionPrefab) { var explosion = Instantiate(explosionPrefab, new Vector3(transform.position.x, transform.position.y, -1.0f), Quaternion.identity); explosion.transform.parent = GameObject.Find("Explosions").transform; } shooter.DestroyBullet(gameObject); }