this is a script for fading flashlight. the engine keeps saying “light is not a member of ‘System.Type’”?
what is wrong?
plus, “No appropriate version of ‘UnityEngine.AudioSource.PlayOneShot’ for the argument list ‘(System.Type)’ was found”? i don’t think there is any “javascript grammar” error, but these error message keeps popping out.
what happened? and how do i fix it? some help would be appreciated.
var onClick = AudioClip;
var lightSource = Light;
function Start ()
{
lightSource.light.enable = false;
lightSource.light.intensity = 2.85;
}
function Update()
{
if(lightSource.light.enable == true)
{
lightSource.light.intensity -= 0.1 * Time.deltaTime / 5;
Debug.Log(lightSource.light.intensity);
}
if(Input.GetKeyDown("f"))
{
audio.PlayOneShot(onClick);
if(lightSource.light.enabled == false)
{
lightSource.light.enable == true;
}
else
{
lightSource.light.enabled = false;
}
}
}