You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found the problem and a fix!
It is related to a comma separator being used for real number representation in strings instead of dot separator.
In my region (Brazil) comma is used instead of dot. So when the javascript tries to parseFloat(UTF8ToString(value)) the float value gets clamped. The solution was in the C# side:
In the Player class, inside the method public void SetState(string key, float value, bool reliable = false), apply the InvariantCulture parameter when converting the float to a string, like this: SetPlayerStateFloatByPlayerId(id, key, value.ToString(System.Globalization.CultureInfo.InvariantCulture), reliable);
The text was updated successfully, but these errors were encountered:
Any toStrings and similar data conversions should adhere to this rule. We will first update setState, test it, ensure it's working fine in Brazil and similar settings, then port it to the other functions.
Closing as completed in #30. However, it is possible that this issue lurks in more string-like places. Will keep an eye out and refer here if we find it again.
bug report:
I found the problem and a fix!
It is related to a comma separator being used for real number representation in strings instead of dot separator.
In my region (Brazil) comma is used instead of dot. So when the javascript tries to
parseFloat(UTF8ToString(value))
the float value gets clamped. The solution was in the C# side:In the Player class, inside the method
public void SetState(string key, float value, bool reliable = false)
, apply the InvariantCulture parameter when converting the float to a string, like this:SetPlayerStateFloatByPlayerId(id, key, value.ToString(System.Globalization.CultureInfo.InvariantCulture), reliable);
The text was updated successfully, but these errors were encountered: