Game says colors are different but they actually aren't?

I have a player and if the player collides with an obstacle that’s the same color as them if(obstacle.color == player.color) the player’s color randomizes. However, When the player collides with the red obstacle (and they’re red) it says it’s a different color. But if I use the pipette tool to change the obstacle color and grab the color from the player right before they collide, then it says they’re the same. And here’s the strangest thing: if I use the pipette tool on the obstacle itself (the color doesnt change at ALL) right before the player hits, then it works. What?!

Any advice on how to troubleshoot this? I’m super confused as of right now.

This could be due to floating point precision issues you may wish to do something like this

if (Mathf.Approximately(color1.r, color2.r))
{
     // do stuff
}