Alright, so i have been trying to get a gameobject to slowly transition through the colors of the spectrum/rainbow through code. I have tried to increment the r/g/b values, but nothing seems to work.
Any help would be greatley apreciated,
Have you looked at Color.Lerp? However, to do a rainbow transition will require you to a little bit of manual work; you will need to Lerp between a few color (red → yellow → blue → red ) using a switch to control what color it will change to.
Another alternatives would be using HSV/HSL instead of RGB for your color, by controlling/interpolate the Hue in the HSV/HSL ( from 0.0 - 1.0 ), you will get a nice hue in rainbow color. However, this would require you to do the calculation to convert HSV/HS> to RGB.
Going through a spectrum using RGB is very difficult; instead you should use HSB. That way you can increment the hue component.