How to put a code to automatically turn off the players flashlight once they touch or enter water. Once they get out of the water the flashlight is still off until they press F again.
My flashlight script.
function Update () {
if (Input.GetKeyDown("f")) {
if (light.enabled == true)
light.enabled = false;
else
light.enabled = true;
}
}