Why isn't my integer changing when onTriggerEnter is called?

Hi,

I’m creating a game where you cross two lanes of traffic and I’m trying to get it so when my player collides with a certain car it tells me which car it was. I’ve tried making it so if it hits carA it results in the variable carCollision changing to 1 etc. But when the player collides with all cars in game it just produces ‘0’. What am I doing wrong?

public class CollisionCar : MonoBehaviour
{

void OnTriggerEnter(Collider col)
{
    //Debug.Log(gameObject.name + "has collidied with" + col.gameObject.name);
    if (col.gameObject.tag == "carA")
    {
        mainManager.carCollision = 1;
    }
    if (col.gameObject.tag == "carB")
    {
        mainManager.carCollision = 2;
    }
    if (col.gameObject.tag == "carC")
    {
        mainManager.carCollision = 3;
    }
    if (col.gameObject.tag == "carD")
    {
        mainManager.carCollision = 4;
    }
    Debug.Log(mainManager.carCollision);
}

}

Thank you so much, I realized I had attached the script to the cars instead of the player.