can someone help me, I have this script
static var Money = 5;
var Money2 = 0;
function OnGUI() {
Money2 = Money;
GUI.Box(Rect(200,0,100,40),"Money");
GUI.Box(Rect(200,120,80,40),Money2);
}
but unity won’t let me use an intiger in a gui.
can someone help me, I have this script
static var Money = 5;
var Money2 = 0;
function OnGUI() {
Money2 = Money;
GUI.Box(Rect(200,0,100,40),"Money");
GUI.Box(Rect(200,120,80,40),Money2);
}
but unity won’t let me use an intiger in a gui.
in C# there is a .toString() method with all kinds of fun formatting options. I would look up the docs for JavaScript. Do a Google search.
you can just do
static var Money = 5;
var Money2 = 0;
function OnGUI() {
Money2 = Money;
GUI.Box(Rect(200,0,100,40),"Money");
GUI.Box(Rect(200,120,80,40),Money.ToString()); //and in the parentheses after ToString, put "f0" to keep a float without a decimal, so for 2.012891738974, it'd just be "2".
}
ToString isn’t C#, it’s .NET, so it’s the same for all languages.
–Eric