Heya, I’m having abit of a problem with this code, Everything in this code works when i remove “Audio codes” but soon as i want to add the Audio back in the code it as problems this code works in Unity3/4 but Unity 5 it doesn’t want to work.
Thank you if anyone can help this is Java script
#pragma strict
var torchClick : AudioClip;
var flashLight : Light;
function Start()
{
flashLight.light.enabled = false;
flashLight.light.intensity = 8;
}
function Update()
{
if(flashLight.light.enabled == true)
{
flashLight.light.intensity -= 0.1 * Time.deltaTime / 5;
Debug.Log(flashLight.light.intensity);
}
if(Input.GetKeyDown("f"))
{
AudioClip.PlayOneShot(torchClick);
if(flashLight.light.enabled == false)
{
flashLight.light.enabled = true;
}
else
{
flashLight.light.enabled = false;
}
}
}