- Home /
converting "int" to "string"
How is this done? i've tried everything i know about it but i need to have it done to have an int value displayed in a GUIText component.
Any Help is appreciated
biohazard
Answer by Mortennobel · Jul 12, 2011 at 08:27 AM
In many cases you can just implicit conversion (by adding a int to a string:
Example:
Debug.Log("Implicit convertions "+321);
If you want explicit to convert int to string use ToString() function:
Example:
var t : int = 1234;
Debug.Log(t.ToString());
so it would be:
$$anonymous$$yGUIText.text = int.Parse($$anonymous$$yIntegervariable); ?
It would be
$$anonymous$$yGUIText.text = ""+$$anonymous$$yIntegervariable;
Answer by Franklin_Rain · Jul 12, 2011 at 08:32 AM
You should be notice that the "string",because if the "string" is "123.123",will wrong!
Your answer
Follow this Question
Related Questions
How to convert a string to an int? 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
Flipping textures 0 Answers