I have a script which counts with textures for example 123 would assign the texture 1,2 and 3 to be rendered, but when I only have 1 digit like (5)the others are set to zero making it look like (500)…so how can i disable the zeros until they become meaningful like in numbers (20) or (560)…
// varibles begin //
var TotalPoints:int; // this variable is edited externaly and shows howmany points we have
//***************************
var digit1:int;
var digit2:int; // all these are to store the integers
var digit3:int;
var digit4:int;
//***************************
var CoinsTextTexture: Texture; // texture section this is for the text "coins"
var numbers : Texture2D[];// array of images of numbers 0-9
//***************************
//end of variables//
function Update(){
var s:String = TotalPoints.ToString();
digit1 = int.Parse(""+s[0]);
digit2 = int.Parse(""+s[1]);
digit3 = int.Parse(""+s[2]);
digit4 = int.Parse(""+s[3]);
}
function OnGUI(){
GUI.DrawTexture(Rect(Screen.width*0.0,Screen.height*0.75,70,50), CoinsTextTexture);
GUI.DrawTexture(Rect(Screen.width*0.0,Screen.height*0.85,100,100), numbers[digit1]);
GUI.DrawTexture(Rect(Screen.width*0.04,Screen.height*0.85,100,100), numbers[digit2]);
GUI.DrawTexture(Rect(Screen.width*0.08,Screen.height*0.85,100,100), numbers[digit3]);
GUI.DrawTexture(Rect(Screen.width*0.12,Screen.height*0.85,100,100), numbers[digit4]);
}