- Home /
Make String Update for Value (GUI)
I'm making a space sim, and I need the speed bar to show how fast you're going. My variable for the speed you're going at is currentSpeed, but when I right that in the string part, it doesn't show the current speed. I knew that was going to happen, so how should I make the string show the value of a float?
var currentSpeed : float;
function OnGUI()
{
GUI.backgroundColor = Color.green;
GUI.contentColor = Color.white;
GUI.skin = Skin;
GUI.Button(Rect(10,650,hitPoints,20),"Health");
GUI.backgroundColor = Color.yellow;
GUI.contentColor = Color.white;
GUI.skin = Skin;
GUI.Button(Rect(10,670,currentSpeed * 5,20), "currentSpeed");
}
As you can see, currentSpeed is a string, and won't be the float variable. Is there away for the string to show the value of currentSpeed?
Comment