mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

Bug with SetCenterLatitudeLongitude, in other cultures. (Which I kinda fixed)

Open nicolassanmar opened this issue 4 years ago • 1 comments

  • Unity version: 2020.21f1
    • Scripting Runtime Version: I can´t see it in the place where it´s supposed to be
    • Scripting Backend: Mono
    • Api Compatibility Level: .NET Standard 2.0
  • Mapbox SDK version: 2.1.1
  • The platform you're building to: Windows
  • A description of what you're trying to do:

The issue here is that when I move the camera in the 3_POIPlacement example scene i get tons of errors about wrong number of arguments in the String to LatLong function. Via debugging I found out the problem was in a C# function: string.Format() inside the AbstractMap class in the SetCenterLatitudeLongitude() function , which takes into account your culture and changes the decimal separator from '.' to ',' which causes the mapbox function to fail.

I fixed this by adding System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); in the InitializeMap() function on the AbstractMap class.

I don't know if that is the best solution, or if it will be necessary in other sections of the code, but I hope it can be fixed.

nicolassanmar avatar Jan 13 '21 22:01 nicolassanmar

decimal separator from '.' to ',' Sdk should be using culture information while parsing the float but there might be a bug I guess. Thanks for letting us know! 🙇

brnkhy avatar Mar 05 '21 21:03 brnkhy