Open rafzi opened 11 months ago
Hey, thanks for reporting !
Frankly, the scalar parsing logic comes from Pyyaml library(which does not preserve comments, but it does parse them out apparently) so it does not surprise me that the comment gets stripped out.
In order to try support this we'll probably need to overwrite the scanner logic that Pyyaml does, by allowing the #
character for plain scalars:
https://github.com/yaml/pyyaml/blob/a98fd6088e81d7aca571220c966bbfe2ac43c335/lib/yaml/scanner.py#L735
Probably needs overriding the emitter too: https://github.com/yaml/pyyaml/blob/a98fd6088e81d7aca571220c966bbfe2ac43c335/lib/yaml/emitter.py#L692
See: https://docs.unity3d.com/Manual/UnityYAML.html "UnityYAML does not support comments."
For example, GameObjects' names can contain
#
. In a scene file, it may look like this:The Unity editor shows this in the UI as
Hello # World
, but unityparser will just extractHello
.But I actually found this issue because of the following parsing error. An example scene file:
Note how the name is split across two lines. The trailing
#
seems to cause the error:Happy to submit a PR, but would appreciate some pointers.