- Home /
Money System
I have a money script but I cant figure out how to update the amount of money? here is my money script var money : int = 100; var GUImoney : GUIText;
function AddMoney(amount :int){
money += amount;
GUIMoney = money.ToString();
}
I tried it but when I load he game it does not change how much money I have
Answer by Kiloblargh · Feb 14, 2014 at 11:39 PM
You are trying to assign to a GUIText
variable a String
value in the last line. That's not possible.
What you mean to do is set GUIText.text
, which is a String property of the GUIText class.
Assets/playerscript.js(6,23): BCE0020: An instance of type 'UnityEngine.GUIText' is required to access non static member 'text'. I get this error
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
my unity says that there is mistake 1 Answer
Help for basic board game but for me it's hard.. 0 Answers
Help with variables... 0 Answers
Underwater effects with Unity pro? 2 Answers