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

Add Property to Exclude Header Tags When Saving Unity .meta Files #69

Closed motoyinc closed 6 months ago

motoyinc commented 6 months ago

Description

This merge request introduces a new property to handle Unity meta files more efficiently during the save operation. Unity meta files do not utilize header tags; however, our current save functionality does not differentiate between file types. This update adds a property to identify Unity meta files specifically and ensures that header tags are not included upon saving these files.

sp-ricard-valverde commented 6 months ago

Hi !

Sorry but I believe this functionality, although optional, would break the purpose of this package stated in the documentation which is:

This project aims to provide a python3 API to load and dump Unity YAML files(configurations, prefabs, scenes, serialized data, etc) in the exact same format the internal Unity YAML serializer does.

motoyinc commented 6 months ago

but, the .meta file has no tags mentioned in the documentation. When I edit a .meta file and save it, a tag is added to the file, even though the .meta file originally contains no tags.

The original .meta

fileFormatVersion: 2 guid: e3aaabe8179709270b60483664db46c8 NativeFormatImporter: externalObjects: {} mainObjectFileID: 100100000 userData: assetBundleName: assetBundleVariant:

The modified .meta.

%YAML 1.1 %TAG !u! tag:unity3d.com,2011: fileFormatVersion: 2 guid: e3aaabe8179709270b60483664db46c8 NativeFormatImporter: externalObjects: {} mainObjectFileID: 100100000 userData: assetBundleName: assetBundleVariant:

sp-ricard-valverde commented 6 months ago

You are right, I've added a test to prove it. I don't think the solution to this problem should be an optional parameter but rather to preserve the previous yaml tag state and avoid adding them if they were missing. Let me give it a try and see what I can come up with. Thanks for the contribution !