Collisions not occuring??

Hi everyone, I’m making a istrometic game like brawl stars and I have a small error, and kinda silly. When my player shoots, it shoots a sphere and the sphere doesn’t collide with anything, not with the cubes i’ve set in the map and not with other players i’ve placed to test. Why is this? It has a sphere collider and the cubes also have colliders as well? Here is the code as well!

private void OnCollisionEnter(Collision collision)
       {
            Destroy(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
        }
    }

Would really appreciate for some help!

Wrong subforum, this is for Unity Visual Scripting tool also known as Bolt.

Your code above isn’t valid at all. Looks like you typed it wrong either here or in Unity.

1 Like

The code as posted will not compile.

Yeah sorry about that, I had a problem when I posted the code, here is the actual code

private void OnCollisionEnter(Collision collision)
    {
        if(collision.transform.tag == "Enemy")
        {
            Destroy(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
        }
    }

I also though about this error and thought is it because maybe animations are playing?