- Home /
can you turn a TEXT into a int?
Ok I have a GUI Text that i need to turn into a int
public Text Blah; public int BLahINT;
BLahINT = Blah.text
everything I've looked up is how to display a int as TEXt cn u get a int from Text without making it a string first?
Comment
Best Answer
Answer by aditya · Dec 02, 2016 at 05:10 AM
int.TryParse(Blah.text, out BLahINT);
if you have numbers in your text then this will work but if you have even a single alphabet then it might no work
This will be converted
125489
This will not
text125489
Your answer
![](https://koobas.hobune.stream/wayback/20220612101846im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
[4.6 UI] Show text as an int variable error 2 Answers
I can't print a int.ToString() variable in a guiText.text 1 Answer
Old school score text 3 Answers
Add multiple ints to a string line. 2 Answers