socialpoint-labs / unity-yaml-parser

Python3 library to manipulate Unity serialized files from outside the Unity Editor.
https://pypi.org/project/unityparser/
MIT License
137 stars 24 forks source link

"-0" is not preserved in original file #66

Closed rafzi closed 6 months ago

rafzi commented 11 months ago

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.

sp-ricard-valverde commented 11 months ago

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.

rafzi commented 11 months ago

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