Destroy GameObject on collision

Hi!

I’m making some kind of bullet and I need it to destroy whenever it hits something, UNLESS, the object it hits has the tag “Enemy”. So, if you know what to do, please tell me.

Thanks

you just need a bit of logic and read up the documentation:

void OnCollisionEnter(Collision other)
{
    if(!other.gameObject.CompareTag("Enemy"))
    {
        Destroy(gameObject);
    }
}