I’ve got this pickup script in the works, but no matter what I do i can’t fix it.
var moneydisp : GUIText;
var money = 20;
function Update ()
{
moneydisp.text = "Bananas! : "+ money;
}
function OnTriggerEnter()
{
Debug.Log("You have picked up a banana");
Destroy(gameObject);
money++;
}
So obviously, this is supposed to add one when you hit a banana trigger, and that’s not happening. Also, in the inspector, when I set the money variable to 1, the guitext still prints 20, and still won’t add. I need some guidance on how to get this to work, it’s a pretty key script in my project.