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

Parser failing on ProjectSettings.asset #39

Closed v2k closed 2 years ago

v2k commented 2 years ago

Unity2019.4.38f2 seems to think this is a valid setting in ProjectSettings.asset. Not sure how it got to be this way:

  apiCompatibilityLevelPerPlatform:
    : 3
    Standalone: 3
[14:09:17]W:         [Python run] Traceback (most recent call last):
[14:09:17]W:         [Python run]   File "C:\BuildAgent\work\8a77f9fd28f2be7\Utilities\TeamCity\SetProjectDefines.py", line 28, in <module>
[14:09:17]W:         [Python run]     doc = UnityDocument.load_yaml(project_settings_file)
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\unityparser\utils.py", line 44, in load_yaml
[14:09:17]W:         [Python run]     data = [d for d in load_all(fp, register)]
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\unityparser\utils.py", line 44, in <listcomp>
[14:09:17]W:         [Python run]     data = [d for d in load_all(fp, register)]
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\unityparser\utils.py", line 106, in load_all
[14:09:17]W:         [Python run]     yield loader.get_data()
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\constructor.py", line 45, in get_data
[14:09:17]W:         [Python run]     return self.construct_document(self.get_node())
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\composer.py", line 27, in get_node
[14:09:17]W:         [Python run]     return self.compose_document()
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\unityparser\composer.py", line 14, in compose_document
[14:09:17]W:         [Python run]     node = self.compose_node(None, None)
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\composer.py", line 84, in compose_node
[14:09:17]W:         [Python run]     node = self.compose_mapping_node(anchor)
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\composer.py", line 133, in compose_mapping_node
[14:09:17]W:         [Python run]     item_value = self.compose_node(node, item_key)
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\composer.py", line 84, in compose_node
[14:09:17]W:         [Python run]     node = self.compose_mapping_node(anchor)
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\composer.py", line 133, in compose_mapping_node
[14:09:17]W:         [Python run]     item_value = self.compose_node(node, item_key)
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\composer.py", line 84, in compose_node
[14:09:17]W:         [Python run]     node = self.compose_mapping_node(anchor)
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\composer.py", line 127, in compose_mapping_node
[14:09:17]W:         [Python run]     while not self.check_event(MappingEndEvent):
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\parser.py", line 98, in check_event
[14:09:17]W:         [Python run]     self.current_event = self.state()
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\parser.py", line 425, in parse_block_mapping_first_key
[14:09:17]W:         [Python run]     return self.parse_block_mapping_key()
[14:09:17]W:         [Python run]   File "C:\Users\Greg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\yaml\parser.py", line 438, in parse_block_mapping_key
[14:09:17]W:         [Python run]     raise ParserError("while parsing a block mapping", self.marks[-1],
[14:09:17]W:         [Python run] yaml.parser.ParserError: while parsing a block mapping
[14:09:17]W:         [Python run] expected <block end>, but found ':'
[14:09:17]W:         [Python run]   in "UnityProject/ProjectSettings/ProjectSettings.asset", line 635, column 5
sp-ricard-valverde commented 2 years ago

Omg Unity ... thanks for reporting though !

sp-ricard-valverde commented 2 years ago

Related to #32

It should be fixed in version 2.2.0. Although the order will be fixed when saving the document back