Quantcast
Channel: Latest Questions by GraviterX
Viewing all articles
Browse latest Browse all 122

Door and Key

$
0
0
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; }

Viewing all articles
Browse latest Browse all 122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>