- Home /
Script to GUI text
So I have a basic money script. So far, I have it so every ten seconds you get 1$ but there is no way I can see my money in game without out "Print" so how can I put the amount of money I have inside GUI text?
Scripts=
MONEY EARNING--------------------------------
function Start () { InvokeRepeating ("YoGimmeMoney", 10.0, 10.0); }
function YoGimmeMoney () {
Player_Money.players_money++;
print(Player_Money.players_money);
}
PLAYER MONEY----------------------------------------------
static var players_money = 100;
Answer by Eric5h5 · Dec 29, 2012 at 04:10 AM
guiText.text = Player_Money.players_money.ToString();
Works Great :D. But i have a problem, is there a script i could make that constantly changes the GUI to the amount of money? if i attach it to the earning script it will only show the amount of money every time it adds 1$.
To do this, you could use the Update method, and put this code above inside it.
Your answer
Follow this Question
Related Questions
If statement only work once? 1 Answer
An instance of type 'Script' is required to access non static member 'Variable' 1 Answer
It is not possible to invoke an expression of type 'int'. 1 Answer
Help with GUI Currency 1 Answer
Only allow user to instantiate game object when he has a certain amount of points(money) 1 Answer