Hi Everyone, I’m here again
I have a trigger outside each door so when I collide with it it shows the room number and says press C to open the only problem is I have a different script for each door so it shows I different room number.
My code is below, I just what to know how I would compress it down to a single script if possible.
var displayMessage = false;
var font : Font;
var fontSize : int = 20;
function OnTriggerEnter (other : Collider) {
displayMessage = true;
}
function OnGUI () {
if (displayMessage){
GUI.Label (Rect (10, 10, 200, 60), "Room 2
Press C To Open");
GUI.skin.label.font = GUI.skin.button.font = GUI.skin.box.font = font;
GUI.skin.label.fontSize = GUI.skin.box.fontSize = GUI.skin.button.fontSize = fontSize;
}
}
function OnTriggerExit (other : Collider) {
displayMessage = false;
}