He is using WIndows 10 but he informed me that in Latin languages they use comma as decimal separator. I think Windows is causing this formatring issue.
Can I force AppendFormat to use a decimal point ā.ā as the separator under all circumstances (regardless of culture)?
Thanks everyone for those quick responses. I have added the changes by searching through my project and adding the CultureInfo.InvariantCulture directive to each format function in my CSV class.
I wonder if there is a way to just enforce InvariantCulture globally?
But for now I have changed my earlier example to something resembling this:
I just attempted this on a Windows 7 machine, and using the exact same application that I sent to my friend.
I really would like to recreate the issue here, but how do I set Windows to use Latin formatting in Unity?
I tried both Portuguese (Brazil) and Azeri (Latin, Azerbaijan) system locale settings, but in both instances the decimal separator remained as a period characters.
Brilliant! Thank you so much, I can confirm this works just fine, case closed.
I was able to reproduce the exact problem too by going to the Format tab in Windows and changing the Format to Protuguese (Brazil). Then in my game running on Windows 7 I saw that it was adding commas for all decimal separators causing CSV corruption:
I verified Kurtās suggestion using Win7 and running two identical versions of my game where one called: Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
and the other was unmodified.
The build that set InvariantCulture globally was working perfectly fine (decimal separator = ā.ā).
The unmodified build was full of bugs and corrupted csv was everywhere (decimal separator = ā,ā).
An interesting note, in Windows 10 I saw a different result. I changed the format setting (as above) but both builds still ran fine. I also noticed that the Decimal symbol dropdowns differs between the two OSes where Windwos 10 has multiples??
And when changing only the system locale setting then rebooting, it did not reproduce the issue and both builds ran fine:
I was not expecting Windows formatting options to be capable of completely wrecking my game, guess it just goes to show how one should always test every possible configuration. And I know from now on I will be including that little line of code in every projects I ever create.
Yeah, I get where youāre coming from but unfortunately more and more of the our game engines rely on passing thickly through the OS, such as video drivers, audio, etc., so an unexpected change in some middleware layer and bam, down we go in flames. I coulda fallen for this same problem Iām sure.
Iām gonna bet the Win10 problem difference is just because you havenāt installed some patch, or else some ālocale packageā or something, or else your computer OS isnāt licensed for those countries, silly stuff like that.