Quantcast
Channel: Latest Questions by thecoolracer
Viewing all articles
Browse latest Browse all 33

OnTriggerStay and OnTriggerEnter won't react when the player enters them.

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

Viewing all articles
Browse latest Browse all 33


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