Hi guys, I’ve been making a switch script, the idea is when player in the collider can press key to turn on and off lights (with sound) but my script doesn’t works, here is the script , thanks and sorry for my english
var luz : GameObject ;
var Volume : float = 0.5;
function Start () {
audio.volume = Volume;
}
function Update () {
if(Input.GetKeyUp(KeyCode.E))
{
luz.active = true;
audio.Play();
}
else if(Input.GetKeyUp(KeyCode.E))
{
luz.active = false;
}
}
function OnTriggerEnter (other : Collider)
{
if(other.gameObject.tag == "Player")
{
luz.active = true;
}
}
function OnTriggerExit (other : Collider)
{
if(other.gameObject.tag == "Player")
{
luz.active = false;
}
}