How to detect collision between 2 objects while checking are they the ones that need to collide?

I’ve got 4 different color box colliders and 4 blue, red, yellow and green object colliders. I need to make it that when a blue object collider hits a blue box collider, it would give you points, if colors do not match, you would lose.

So any ideas how to detect collision between 2 very specific objects?

It’s pretty simple. You need to have a script on each object with a function OnTriggerEnter(Collider other) and inside that function check if the colors are the same, or not. For example, for sprites it would be like this:

void OnTriggerEnter(Collider other)
{
    if (other.collider.GetComponent<SpriteRenderer>().color == gameObject.GetComponent<SpriteRenderer>().color) {
       // here you add points
     } else
     {
       // here you substract them
     }
}

Notice that this will add or sub points twice, one for each script.