This code is designed to control a glow effect on a camera. The intended effect is for a bomb to go off (in this case a nuclear weapon), and a glow is to be triggered, which fades after a few seconds. In order for the glow effect to be faded completely without actually disabling it is to change it’s colour to black. This is the code I have built. It worked fine and it faded, but after i put in the three lines where it would change the colour, it called a missing field exception. How do I address the colour of the glow effect?
var rate : float = .25;
var Glow : float = 3;
var glowStart : int = 3;
function Update () {
GetComponent("GlowEffect").glowIntensity = Glow;
GetComponent("GlowEffect").Color.r = Glow * 85;
GetComponent("GlowEffect").Color.g = Glow * 85;
GetComponent("GlowEffect").Color.b = Glow * 85;
if(Glow > 0){
Glow = Glow - (rate * Time.deltaTime);
}
}
function OnEnable () {
Glow = glowStart;
GetComponent("GlowEffect").enabled = true;
}
function OnDisable () {
GetComponent("GlowEffect").enabled = false;
}