Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » FREE Project Downloads & Recources » Scripts » FlashLight Script

FlashLight Script

View previous topic View next topic Go down  Message [Page 1 of 1]

1 FlashLight Script on Sat Feb 20, 2016 6:18 pm

joe2134254676879080-9


Member [Lv. 2]
Member [Lv. 2]
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;

    }

}

View user profile

2 Re: FlashLight Script on Wed Mar 09, 2016 7:38 pm

DeveloperLuke


Moderator
Moderator
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;
  }
}

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum