Changing a bunch of lights intensity

Hi there, I’m trying to change a bunch of lights intensity levels within a time period, however before I can even assign the lights I get an error message saying that the “.intensity” is not a member of the unity engine. This is my script, can anyone fix it?

#pragma strict

var lightaa : GameObject;
var lightab : GameObject;
var lightba : GameObject;
var lightbb : GameObject;
var lightca : GameObject;
var lightcb : GameObject;

lightaa.intensity = 0;
lightab.intensity = 0;
lightba.intensity = 0;
lightbb.intensity = 0;
lightca.intensity = 0;
lightcb.intensity = 0;

function Start () 
{
	yield WaitForSeconds(4);
	lightaa.intensity = 1.0;
	lightab.intensity = 1.0;
	yield WaitForSeconds(4);
	lightba.intensity = 1.0;
	lightbb.intensity = 1.0;
	yield WaitForSeconds(4);
	lightca.intensity = 1.0;
	lightcb.intensity = 1.0;
}

Thank you for your help…

I assume that all of your ‘lightxx’ variables are initialized by drag and drop in the Inspector. To fix your problem, you need to make these variables of type ‘Light’ not type ‘GameObject’.

var lightaa : Light;

Note that after making this change, you will need to again drag and drop your lights on to the variables.

1 : as robertbu said change var lightaa : GameObject; to var lightaa : Light; (All of them)
2 : you are trying to set the light intensity out of any function, i mean change
lightaa.intensity = 0;
lightab.intensity = 0;
lightba.intensity = 0;
lightbb.intensity = 0;
lightca.intensity = 0;
lightcb.intensity = 0;

to

 function Awake(){
   lightaa.intensity = 0;
   lightab.intensity = 0;
   lightba.intensity = 0;
   lightbb.intensity = 0;
   lightca.intensity = 0;
   lightcb.intensity = 0;
 }