Answer the question
In order to leave comments, you need to log in
How to make an account?
I have objects that are assigned certain numbers, when a player collects them, the sum of the numbers on these objects is recorded in the score, how to do this?
Answer the question
In order to leave comments, you need to log in
Throw this script on objects with a coin:
public int CoinValue = 1; // Какое значение в себе содержит эта монетка?
private void OnMouseDown(){
MoneyEvent.MoneyAmount += CoinValue;
Destroy(gameObject);
}
public class MoneyEvent : MonoBehaviour{
public Text txt;
public static int MoneyAmount = 0;
void FixedUpdate(){
txt.text = MoneyAmount.ToString();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question