-
-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables corrupted (in some locales) when calling Custom Commands with float arguments #369
Comments
Ok so this is a bit of an interesting bug that is the side-effect of a quirk of Yarn Spinner and I just wanted to add a little bit of context to this "fix". The wrinkle comes from when using interpolation to inject values into commands. A temporary fix for this is the newly added |
Yeah I basically ended up writing my own helper that does exactly this as a workaround. It mostly feels icky because we're formatting to string and then immediately parsing it back to a float to call the c# handler. My main worry about these workarounds is discoverability. Perhaps the vscode plugin could detect float variable usage with command args and flag/wrap them automatically? Though, if the language server can do this, maybe the compiler could even transparently inject the float2str() call internally? (Still icky but less of a time bomb) |
What is the current behavior?
When a variable is declared as a float, and passed to a custom command that expects a float. No string conversions are expected nor should be implied.
Consider the following script:
I would expect the handler to receive the float value of 55 hundredths (0.55), not 55.
The latter occurs in some locales (e.g., Austria, Argentia, and others) that use commas as decimal separators, and periods as thousands separators.
Please provide the steps to reproduce, and if possible a minimal demo of the problem:
In YarnSpinner-Unity, define the following commands in c#:
And run the following YS script:
When running this, unity outputs:
What is the expected behavior?
When running this, I would expect unity to output:
Please tell us about your environment:
Other information
The text was updated successfully, but these errors were encountered: