I have this script but I don’t understand why the light doesn’t work.
#pragma strict
var instruction : GameObject;
var lighty : GameObject;
var trigger : boolean = false;
var lightswitch : boolean = false;
// lighty is a point light and instruction is GUI instructions
function Start ()
{
instruction.SetActive(false);
lighty.SetActive(false);
}
function OnTriggerEnter ()
{
instruction.SetActive(true);
trigger = true;
}
function OnTriggerExit ()
{
instruction.SetActive(false);
trigger = false;
}
function lighton ()
{
if (trigger == true && Input.GetKeyDown(KeyCode.E))
{
lightswitch = true;
}
}
function lightdoes ()
{
if (lightswitch == true)
{
lighty.SetActive(true);
}
}