THIS IS NOT OFF TOPIC AT ALL DON’T CLOSE! Can someone give me a script so when you press mouse 1 the spotlight disappears, and when you let go of mouse 1 the spotlight comes back.
Try this:
You have a problem. Break it down into smaller problems:
- In Update,
- If mouse1 is down,
- Then turn off the spotlight
- Else,
- Turn it on.
How do I check mouse1? Input.GetButton.
How do I get the spotlight in the script? var spotlight : GameObject;
How do I turn it off? spotlight.[SendMessage][2]("turnOff"); And then have a script that receives the message and turns off the light.
How do I turn it on? repeat above step with “turnOn”. Or better yet, create a method that does both and uses a Boolean to determine on/off.
Use this technique and complex problems become simple.