Problem with OR statement in C #

Hi, I am having problems with the unity rejecting my OR statement:

    void OnTriggerEnter (Collider other)
    {
        if (other.tag == "Boundary") || (other.tag == "Asteroid")
        {
            return;
        }
       
    Destroy(other.gameObject);
    Destroy(gameObject);
    }
}

I think it’s because of missing parentheses:

if ((other.tag == "Boundary") || (other.tag == "Asteroid"))

Alternatively, if you don’t intend to keep the parentheses inside:

if (other.tag == "Boundary" || other.tag == "Asteroid")
2 Likes

Thank you Effervescent, that worked.