I am new to unity and i am making a clone of a a game in which i have some problem

Can any one help : – here is my problem --I want to detect color in my 2d game by raycast, " my game is like this " :---- there are two balls uppside and downside , one of black and other of white . if player hit aby ball and if color of that ball is equal to color of player then only incriment the score other wise game is over , here is screenshot of my game :–

I’m not entirely sure what you mean, but I’d recommend just giving each ball a new script with the property:
Color color;
and setting that to either:
color = Color.white;
or
color = Color.black;

Do you have any experience with C#? If not, I’d like to recommend you this tutorial:


I understand its a bit lengthy but I recon it’d be worth your time following if not at least watching.