We have a unity game that has been running on 5.6.4p1 for years and have recently updated to 2018 and found that there is a significant change to the way various functions default to culturally aware or not.
The first related issue we ran into was with periods being replaced by commas when parsing floats from string data in various places. Apparently 5.6x unity just under the hood defaulted to not require culturally invariant parameters to these sort of functions, so we got away for years with not providing those functions.
Fast forward to 2018 and now users running different OS languages and such have busted games because that behavior has changed. I’m sure it’s arguable that 5.6 was the broken behavior in this sort of situation, but someone had to have known that even so, it represented a huge underlying change in behavior that results in a lot of difficult to uncover bugs for any apps ported forward.
We thought this issue was limited to float parsing, and it wasn’t until much later that it appears that string.ToLower() (without the cultural parameter) is different in 2018 than 5.6 as well. For example, the lower case ‘i’ in a string (U+0069 : LATIN SMALL LETTER I), on some OS languages is being replaced by U+0131 : LATIN SMALL LETTER DOTLESS I, which in our case is then breaking a switch statement. No telling how many other cultural issues are hiding in our code.
One approach is obviously to go through and try and ensure that all calls to these functions use the one that takes the cultural info parameter, but this is too reactionary and impossible to be sure you have covered all the use cases of.
Has anyone else ran into this issue and found another workaround? Especially once you throw in closed source assembly plugins, unless there is a way to globally force the unity app to old behavior, one can’t be sure there aren’t still busted stuff lingering in the code to be found.
I believe we even tried to force the culture info of the app globally and iirc it didn’t seem to work in unity.
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture