I don't work with raycasts because they're taxing, but do you have an else statement following the if? IE:
if(raycasthit){
change color;
} else{
return color;
}
the process to return the color should be the same as when you applied it, so it shouldn't be hard. I imagine it's something like, "else if(raycast.hit == null)" or "else if(raycast.hit != this.gameObject" or something, but like I said, I don't go near em.
↧