Hey,
so I started making this script in JS where you can turn it on and off with RMB.
This is what I got so far.
#pragma strict
var torchState : boolean;
function Start()
{
torchState = true;
}
function Update()
{
if (Input.GetButtonDown("Fire1") && torchState)
{
GetComponent(Light).enabled = false;
torchState = false;
}
if (Input.GetButtonDown("Fire1") && !torchState)
{
GetComponent(Light).enabled = true;
torchState = true;
}
}
It doesn’t work at all. Any ideas what is wrong with it?