FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionFlashLight Script

more_horiz
Assign to Empty GameObject that has a light on it

[You must be registered and logged in to see this link.]


Show Code :
function Update() {
if (Input.GetKeyDown("f")) {

    if (light.enabled == true)

        light.enabled = false;

        else

        light.enabled = true;

    }

}

descriptionRe: FlashLight Script

more_horiz
I think this is to much code.
You can just do light.enabled = !light.enabled;

Code:

function Update() {
if (Input.GetKeyDown("f")) {
      light.enabled = !light.enabled;
  }
}
Permissions in this forum:
You cannot reply to topics in this forum