inkle / inkle/ink

Float variables are printed with either comma or dot based on system regional settings

Open
#916 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

**Issue:**
`story.CurrentTags` returns a tag with a float value either comma or dot separated (`0,15` and `0.15`)
`"audioambient:asset\'ambient_sanctuary_deep\',volume\'0,15\',loop\'0\'"`
or
`"audioambient:asset\'ambient_sanctuary_deep\',volume\'0.15\',loop\'0\'"`

**Cause:**
The reason is that those values are taken from a variable which seem to be converting floats based on system regional settings(No Invariant Culture is being used)
This makes tags inconsistent as this persist on a compiled game and happens both in inky editor, Unity engine or in a compiled game.

**Test:**
Regional Settings in Win11: Control Panel -> Region -> Format -> Switch between USA/Polish to see the difference.
You have to restart a compiled game or exit/enter playmode or restart ink editor with double arrow

Inky code:
```
VAR testFloat = 1
VAR constVal = 0.0001

Test {testFloat * constVal}
```
This will print `0.0001` or `0,0001` based on system region format in inky editor, unity playmode, compiled game.

**Extra Context**
We have had a short discussion on discord, but I tried to include most of it in this issue.
https://discord.com/channels/329929050866843648/471562851346153474/1290727976824209470

Might be related: https://github.com/inkle/ink/issues/842
This reply has a code that seems to be converting floats with `.ToString()` https://github.com/inkle/ink/issues/842#issuecomment-1546962577

I will test it if I can find that script.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.