Hey all. I just wrote this script for a key in my game as sort of a key-door mechanic. I want the Player to be able to pickup the key and have another script (attached to the door) activate. However, I'm getting this error: Assets/Scripting/Door/Key.js(25,14): BCE0034: Expressions in statements must only be executed for their side-effects.
Any help?
var keyObject : GameObject;
var hasKey;
var inRange;
var Door : MonoBehaviour;
function OnTriggerEnter() {
inRange = true;
}
function OnTriggerExit() {
inRange = false;
}
function Update() {
if(Input.GetButton("Fire1") && inRange == true)
{
Destroy (keyObject);
hasKey = true;
key();
}
}
function key()
{
Door.enabled;
}
Trending Articles
More Pages to Explore .....