UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionSimple Flashlight script  EmptySimple Flashlight script

more_horiz
to get this script to work just add a flashlight to the player and attach this script to it .... i know really simple but it works fine

Code:

var FlashSound : AudioClip;
var linkedLight : Light;

function Update () {
    if(Input.GetKeyDown("f")){
        linkedLight.enabled = !linkedLight.enabled;
        audio.PlayOneShot(FlashSound, 1.0 / audio.volume);
   }
}

function LightOff (){
   linkedLight.enabled = false;
   audio.PlayOneShot(FlashSound, 1.0 / audio.volume);
}   

descriptionSimple Flashlight script  EmptyRe: Simple Flashlight script

more_horiz
Thanks for sharing Very Happy 

descriptionSimple Flashlight script  EmptyRe: Simple Flashlight script

more_horiz
Thanks, needed this

descriptionSimple Flashlight script  EmptyRe: Simple Flashlight script

more_horiz
I am posting an ADVANCED flashlight script in about 30 minutes  Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy 

descriptionSimple Flashlight script  EmptyRe: Simple Flashlight script

more_horiz
Hey, is this for javascript? It looks like it, but just to be certain.

descriptionSimple Flashlight script  EmptyRe: Simple Flashlight script

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply