Collision Trigger Not Working on Collision

Hello, I’ve been having an issue with my collision code. In the scene, I have a ball, some ground, and a hole that is a mesh. The goal is to reward the player points if they get the ball in the the hole. The ball has a rigidbody and a collider, and the hole has a mesh collider with convex and isTrigger enabled. The issue is that nothing happens when the ball touches the holes collision field. Using debug, I was able to find that that the collision function does work, the ground if statement does work, but the flag if statement does not work.

    public void OnCollisionEnter(Collision other)
    {
        if(other.gameObject.tag == "flag")
        {
            Debug.Log("TagCollision");
            if (other.gameObject.gameObject.name == "BlueFlag")
            {
                scoreNum += 100;
                Debug.Log("NameCollision");
            }
        }

        if(other.gameObject.tag == "ground")
        {
            onGround = true;
            ResetBall();
        }
    }

I have also found that setting isTrigger to false works, but the ball bounces out of the hole.

If someone could help me out here or refer me to another thread, I’d greatly appreciate it.,

Hello there.

You nned to use OnTriggerEnter() function (not OnCollisionEnter)

Bye!