I need help how would one use a variable with renderer.material.color=Color.blank? I do renderer.material.color=Color (var); when I have my var defined am I doing it right because in the console it says it is wrong.
if i got your question right, it depends on you material shader. if the color is multiplied then you may just set it to black.
has this example
// Fade the color from red to green
// back and forth over the defined duration
var colorStart : Color = Color.red;
var colorEnd : Color = Color.green;
var duration : float = 1.0;
function Update () {
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
renderer.material.color = Color.Lerp (colorStart, colorEnd, lerp);
}
the vars are set as “Color.red” “Color.green” etc. if we ignore the extra lerp bit you get
var myColor : Color = Color.red;
function Update () {
renderer.material.color = myColor;
}
Oh okay didn’t understand the Mathf.Pingpong thing quite yet but I did understand the bottom one thank you so much!