I have a script which checks if the player has entered the trigger and if it is then ask if he wants to buy ammo, the strange thing is - the trigger simply doesn’t work while a similar method works for zombies.
Here is the code:
var Bought : boolean = false;
var LAAS : boolean = false;
function OnTiggerStay (collision : Collider) {
if(collision.tag == "Player") {
LAAS = true;
}
}
function OnTriggerExit (collision : Collider) {
if(collision.tag == "Player") {
LAAS = false;
}
}
function Update () {
if(LAAS == true) {
if(Input.GetKey(KeyCode.E)) {
}
}
}
function OnGUI () {
if (LAAS == true) {
GUI.Label(Rect (10, 50, 300, 20), "Press E to buy 1 mag for 20 points");
}
}