Hi,
Is this possible to use UnityYAMLMerge to filter diffs for use in VCS software? My issue is that when modifying a scene, for example, I have a lot of “false positive” changes where most of them are just rounding error on transform. As a test, I opened a relatively small scene and changed 7 mass properties of 7 different rigidbodies and saved the scene. In theory, I should have 7 lines changes in the scene file and nothing else. But I end up with 55 changes where at least half of them (and probably more like 90% of them) are just rounding error on floating point number for translation and rotation as you can see on the linked image. So, is there is a way to use
UnityYAMLMerge to “fix” a diff so it would revert the rounding using the same mergerules.txt
This is rather annoying because it make the diff unnecessary unreadable and in turn gives people the bad habit of just glancing over the diff instead of checking they don’t introduce unwanted changes. Also, if you want to commit cleanly you have to revert all these false changes manually which is time consuming.
Thanks,
2 Likes
I went through this phase of religiously trying to sanitize my YAML commits (prefabs / scenes / assets / etc) and finally gave up.
Now I only bother looking at YAML when I know for sure the change is one or two items, such as a checkbox or a single number or link.
Beyond that I just treat these changes as binary files, occasionally perhaps looking to verify something got saved.
Coupled with that approach, I also break things up into lots of smaller additive scenes to reduce the need to merge.
Here was the basic economics of my thinking:
-
when working on a cross-platform team (Windows / Mac), the vast majority of changes in the file were these stupid precision changes, especially when working with UnityEngine.UI components.
-
And now that ProBuilder is in play, that thing is a complete DISASTER for source merging: it renames EVERY MESH, every single time you save the scene, which completely negates any differential change ability. (facepalm)
-
many of those changes were not something you could make a regex for easily, at least not that I could see.
-
visually doing it was fraught with all manner of disasters, such as mis-noticing an ACTUAL critical change like this:
- position: 0.05
+ position: 0.850001
It’s just WAY too easy to miss the 0 vs 8, especially if it is a longer chain of decimals.
The other component to this is doing “code reviews” when those reviews also involve prefabs. It just is not possible to reasonably add any value in a code review vis-a-vis the YAML changes, unless as I pointed out they are a single number change. Our team wasted HUNDREDS of man hours laboriously reviewing commits and iterating changes to code, and then upon submission after days of going back and forth and agreeing “Yeah, this is good,” the entire build was still-birthed because someone deleted the EventSystem. It would have been WAY better to just test the build, fix the bugs, and move on, far more productive and reliable.
1 Like
Yeah I kinda agree. Still as a dev, not even glancing over the diff before committing sound just wrong to me. I wonder if it worth a shot of trying to parse the scene/prefab files and build a difftool that can identify and rollback the small precision changes. That way, at least the false should be an order of magnitude less than they are now.