Hello, and how are you?
I'm trying (and very, very hard at that!) to change the colour of an object by picking up other objects, what are a certain colour.
If I was to pick up two red objects and a blue object I would want my object to be 2 parts red and 1 part blue.
Here is the script i'm using.
So yeah... It doesn't work. Maybe a tip or two (something...anything..) on how colour works?
asked Apr 02 '12 at 04:20 PM
The Color object in Unity has 4 components r, g, b and a, all of them between 0 and 1, (1,1,1,1) being white. If you keep adding to your colors, it will inevitably end up white.
What you want is a mix between color. You should look at Color.Lerp. However, an interpolation done that way can give you black or dark color inbetween, and you probably don't want that. You should take a look at HSV colors (hue saturation value), that use a Lerp probably more relevant to your needs.
answered Apr 02 '12 at 04:32 PM