Hello People, im trying to spawn a collectable gameobjet every time my Character Stays within a Trigger and presses a button.
e.g. Move Player in front of an automat, press "E" and spawn a collectable ticket besides the automat. Thats the EXACT way i want it to be happen.
i got it completly working so far with this script:
var object: GameObject;
var object2: GameObject;
function OnTriggerStay(Player : Collider) {
if (Input.GetButtonUp("Action")){
Instantiate (object, Vector3(11,1,16), transform.rotation);
Debug.Log("You can pick up your ticket right next to the vendor.");
}
else
{
if (Input.GetKeyUp("r")){
Instantiate (object2, Vector3(13.4,1,16), transform.rotation);
Debug.Log("You can pick up your ticket right next to the vendor.");
}
}
}
BUT every time i Press the "E" button to instantiate the ticket it instantiates MULTIPLE tickets. i just want a single one tho. Could anyone help me out with this pls ?
thx in advance :)