- Home /
Script doesn't work after android build?
I'm saving some decimal values in the PlayerPrefs with possibility of changing them later... I'm using InputField to enter the values...Then saves them to PlayerPrefs...Do my calculations...then print them again to InputFields Text... The problem is when printing I just want 2 decimal numbers ( like 0.00)...I was using float.ToString("0.00") This worked fine while development on my PC but later when building to android... the app crashes The problem was ( for reading I nead format 0.00 but when printing it's in format 0,00 ) Ex: Input=13.75 OutPut= 13,75
I replaced float.ToString("0.00") by a script private string FormatWriting(float f) { string s = f.ToString(); string result = ""; for(int i=0; i<s.Length; i++) { if (s[i].Equals('.') || s[i].Equals(',')) { if(i==s.Length-1) { //skip }else if(i==s.Length-2) { result += "." + s[i+1]; }else { result += "." + s[i+1] + s[i+2]; } break; } else { result += s[i]; } } return result; }
but again this works fine on my PC but doesn't work on my android device.. Somehow it deletes the "." Ex: Input= 13.75 Output=1375
Any advice please?
Your answer

Follow this Question
Related Questions
Everything working fine in Editor but in device the find object with tag throwing null exception 2 Answers
Unity ThirdPersonController script errors when switching to Android platform. 0 Answers
Speaker/earphone audio output toggle from unity c# script using "Lesser AudioSwitch" app 0 Answers
buildings model disappeared on android build. 1 Answer
Using OnSceneLoad (additive) to activate script on player within active scene 0 Answers