- Home /
 
how to make a float value,debug as int.(or show in text UI as Int)
? :) hi how are you :)
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by MKayJay · Jan 21, 2018 at 11:31 PM
You can simply cast the float to int (and use the int in your string):
     float f = 2.3f;
     int i = (int)f; //The value will be 2, as the decimal part is truncated
     myTextObj.text = "Your number is " + i; 
 
              Your answer
 
             Follow this Question
Related Questions
How to submit float score as time to Game Center? 1 Answer
Possible to convert a Float into an Int? 3 Answers
Does genericList.Sort() go low to high? or high to low? - for ints/floats 1 Answer
What the hell? Cannot convert float to int PROBLEM. 2 Answers
GUI.Label shows volume from a slider 3 Answers