Hi,
We found out since updating to Unity 2022 the RegionInfo.CurrentRegion returns “US” as region even though we are in a different country (happens on editor + android + iPhone). When executing the same command in a normal .Net Application the correct region is returned
We reported the bug as: https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-66646
Is there any other way to find out if the users uses imperial vs metric system?
@JoshPeterson I wanted to tag you for your opinion on this, as it seems previously it was decided on other platforms this is a wont fix and will only be fixed with .Net 6: Unity Issue Tracker - Globalization.CultureInfo.CurrentCulture does not map to system language on OSX
However I would really want this to work earlier because .Net 6 is still a few years away I would guess (and it previously already worked correctly on Android / iOS / Windows)
I used this package quite successfully a few years back:
I’m not sure of how it gets its source info, so it might simply be given bad info from Unity, but at least it’s a point of investigation for you.
We only want a quick way to find out if the user uses metric or imperial measurement.
Also when the wrong region is set the formatting and parsing of strings is wrong (us format instead of local format)
This is just my opinion, but I think the app should be localized specifically for certain cultures, like EFIGS (English, French, Italian, German, Spanish). Whatever you have specifically designed support for in your app should be supported by settings and menu options that you build directly into your app, regardless of the configured system culture. If they want metric or imperial, they should be able to just select that option in your app.
As far as parsing, if you are talking about persistent data saved to disk, it’s recommended to serialize and parse everything using the Invariant culture to avoid any culture dependent serialization/deserialization bugs.
However, I understand that there are scenarios where you may need to parse in a culture specific way, but as I suggested before I would prefer to have a specific scope of culture based formats that I support explicitly. Then I know exactly what I do support and what I don’t support, and I’m in full control of whether those supported cultures are working as expected or not.
If you are set on using the system culture info and don’t want to do everything manually, then sorry for the unhelpful suggestion, but that’s how I would prefer to do it in my own apps.