- Home /
Textfield number only
i want to make a textfield but only number works.
stop editing my subject. i mean "how can use a float on a textfield" but you don't get it ha?
Help us help you, this is not even a question. What have you tried? Do you use a font that might have issues with the letters? What code are you using?
i don't have a code. DropGold = GUI.TextField (Rect (TargetX + 310, TargetY + 300, 142, 25), DropGold, 35);
my DropGold is float. Textfield is a string. $$anonymous$$y question is how can i use a textfield for a float?
please....PLEASE use better tags and a better title. i'm not trying to insult i just tell you that your current title name and tags are misleading and won't get you further. let me retag your question to something more appropriate
Answer by biohazard · Aug 02, 2011 at 01:10 PM
for letting the Player input an amount of gold to drop, you can try using
var EnteredAmountOfGold : String;
EnteredAmountOfGold = GUI.TextField(Rect(TargetX + 310, TargetY + 300, 142, 25), EnteredAmountOfGold,35);
DropGold = float.Parse(EnteredAmountOfGold);
try this.
but i need to assign DropGold. I mean; the player enters how much gold they want to drop.
DropGold = GUI.TextField (Rect (TargetX + 310, TargetY + 300, 142, 25), DropGold.ToString(), 10); right DropGold.ToString() shows the DropGold float like a string but it can't assign to a float. I want to make this editable TextField.