Question by
TheDemonSasha · Mar 07, 2016 at 10:49 AM ·
javascriptguigameobjectitem pickupcollectible-game-objects
How to make a GUI bar that counts items collected
I want to display the amount of items the players collect in a bar on the screen but I cant figure out how to write that in javascript. This is the code I have.
var itemCount : int;
function OnTriggerEnter(col : Collider){
if(col.tag == "Pick Up"){
Destroy(col.gameObject);
itemCount ++;
}
}
`I would also like to have it displayed on the right upper corner of the screen because I have the health bar on the left side.
Comment
Your answer
Follow this Question
Related Questions
GameObject deactivate but don't activate again 1 Answer
Setting EventTrigger in Unity with JavaScript 0 Answers
Disabling random GUI Button from array 0 Answers
Text disappear on OnTriggerExit() 1 Answer