This is the error: Assets/flashlightonandoff.js(1,1): BCE0044: expecting EOF, found ‘Light’.
I am making a game sort of slender-ish and I wanted a button to toggle the flashlight on and off so I have the script. I have tried many different placements of parenthesis’ and can’t seem to get them in the right place without them triggering another EOF error.
Please help. Thankyou in advance.
SCRIPT:
Light : flashlight
bool : on = false;
void Start()
{
flashlight = GetComponentInChildren();;
}
void Update()
{
if(on)
flashlight.light.enabled = true;
else if(!on)
flashlight.light.enabled = false;
if(Input.GetKeyDown(KeyCode.F))
on = !on;
}