int.Parse(), float.Parse(), double.Parse() all not working when exported,int.Parse, float.Parse double.Parse all not working

As the title says, those functions do not work.

They work well when I test within the editor but when I export to UWP they stop working.

The input is from a TMPro Input Field which is configured to get only integer characters.

Result = int.Parse(Text1.text)

When this line of code executed during runtime, I get a FormatException even with inputs such as “12” or “7”.

I had the same issue with the float.Parse() function before I thought it was because my country uses ‘,’ but after specifying CultureInfo.InvariantCulture.NumberFormat in float.Parse() it would still give me the FormatException when the project was built.

I also tried TryParse() but same result.

The functions work well in play mode but when exported everything stops working.

I am using Unity 2018.3.2f 1

Okay found a fix

My input was coming from a TextMeshPro Input Field, and instead of taking the text from the parent I took the text from child TMP UGUI, according to this thread it seems that the child contains formatting characters so it explains why I got FormatException even with simple numbers such as “1” or “2”
Hope I helped whoever has the same problem.