unity-yaml-parser icon indicating copy to clipboard operation
unity-yaml-parser copied to clipboard

"-0" is not preserved in original file

Open rafzi opened this issue 2 years ago • 2 comments

This is probably because it is parsed as int by unityparser, while unity probably parses it as float, where the "-0.0" can be preserved.

Happy to open a PR, but not sure where to start.

rafzi avatar Nov 14 '23 17:11 rafzi

I'm getting to the conclusion that we need to treat every float and int value as str to preserve all uniqueness in Unity formatting the documents as it seems impossible to track every use case.

When the library was released we tried to be clever about parsing some numeric values so they were available to manipulate in Python but I think the safest approach would be to let the user's Python code convert a given str value to a Python type before manipulation if required. If numeric values are not manipulated in any way they will be dumped back in the same exact str format the were serialized.

sp-ricard-valverde avatar Nov 15 '23 10:11 sp-ricard-valverde

Not sure if the following is related, so i create a new issue: https://github.com/socialpoint-labs/unity-yaml-parser/issues/67

rafzi avatar Nov 15 '23 11:11 rafzi