This is my headlamp script. Though my script only allows the headlamp to be ON at the very start and toggled off but I want it to be off at the start so it has to be turned on, and not already on; here is my script please help:
using UnityEngine;
public class HeadLight : MonoBehaviour
{
public Light FlashLightObject;
private bool LightEnabled = false;
void Update ()
{
if(Input.GetButtonDown("HeadLight"))
{
LightEnabled = !LightEnabled;
FlashLightObject.enabled = LightEnabled;
}
}
}