- Home /
pickup with key
i have this script (java) and i want it so i can pick it up / equip it with "f" please help
pragma strict
private var survivalScript : GUISurvival;
function Start () { survivalScript = GameObject.Find("FPSController").GetComponent(GUISurvival); }
function OnTriggerEnter (Col : Collider) { if(Col.tag == "Player")
{
Destroy(gameObject);
survivalScript.currentHunger += 10;
}
}
Please provide more info. What do you want to pick up? a food gameobject? Is the script you posted supposed to be on the food gameobject?
Answer by Johnz1234 · Jun 22, 2015 at 06:38 PM
function OnTriggerEnter (Col : Collider) { if(Col.tag == "Player")
{ if(Input.GetKeyDown(KeyCode.f)){ Destroy(gameObject); survivalScript.currentHunger += 10; }
} }
Your answer
Follow this Question
Related Questions
Problems with key script 0 Answers
Pickable item to unlock doors (Being able to proceed next scene) 2 Answers
Change Colider to Raycast instead? 2 Answers
Trying the get a Pickup key script working, need some help. 1 Answer
FlashLight Fixes Please?? 1 Answer