I have a problem adding up the pickups to the money gui:
PickUp:
var amount : int = 500;
function OnTriggerEnter( other : Collider ) {
gameObject.Find("FiatPuntoPiOk").GetComponent(PlayerMoney).AddMoney(amount);
Destroy(gameObject);
}
Player:
var money : int = 0;
var GUIMoney : TextMesh;
function Start (){
GUIMoney.text = "$" + money;
}
function AddMoney(amount :int){
money += amount;
GUIMoney.text = "$" + amount;
}
it shows up the pickup but not the sum of 2 values, whats wrong?
Thanks in advance