here is a script for toggle light with the e key:
using UnityEngine;
public class LightToggle : MonoBehaviour
{
// Reference to the Light component
private Light myLight;
// Get the Light component from the GameObject
void Start()
{
myLight = GetComponent<Light>();
}
// Update is called once per frame
void Update()
{
// Check if the 'E' key is pressed
if (Input.GetKeyDown(KeyCode.E))
{
// Toggle the light on and off
myLight.enabled = !myLight.enabled;
}
}
}
you can change the sensitivity of the light