I have a Script attached to a simple spot light that is my flashlight, so I tried to add to my existant Flashlight Script a Sound Script, So when I press “f” the light is on and so the sound, and viceversa. Unity finds no errors, but still my sound (a click to know I turn the flashlight on) is not playing when I use “f”. I have added an audio source to the flashlight, the sound on the script and the audio source, I have clicked on Play on Awake to turn that off… Any ideas someone??
My Flashlight Script (Now with audio on it, but not working:/):
var linkedLight : Light; function Update () { if(Input.GetKeyDown("f")){ linkedLight.enabled = !linkedLight.enabled; } } var shootSound:AudioClip; if(Input.GetKeyDown("f")){ audio.PlayOneShot(shootSound); } }