Hello, my name is Daniel and I have a problem.
I’m trying to upgrade a project from Unity 2017 to unity 2019. In 2017 I use float. TryParse to convert a string value to a float and it makes it perfect. However, updating it to 2019 removes the comma from the float value. Can anyone help me? Thank you
It may be that the latest .NET is somehow using a different culture to parse the number. For example, in various countries the period is read as a thousands separator and they use the comma as the floating point. That would explain why 0.00456 is coming through as 456.
You should probably use the ‘invariant culture’ as that’ll guarantee your results across all devices in all countries.
If I remember correctly, Unity sets the .net culture to invariant by default. At least, they used to. Maybe that changed in 2019 and the culture is now set to the actual culture setting.
I’ve had issues with it defaulting to use the local culture (which is probably to be expected) so I tend to just put InvariantCulture in everywhere to make sure.