Order of property serialization in .unity scene files

Hello,

In the past years working with unity and GIT we noticed that our scene files (serialized as text) often got polluted with seemingly unnecessary changes. This rapidly becomes annoying because artists / designers will often commit scene file changes that are not necessary without realizing it, resulting in unnecessary scene merge conflicts.

The simplest example of this is properties serialization that will get moved around in a scene (see image)

These types of changes will occur whenever a scene gets modified, then saved, or whenever our code marks the scene as dirty and saves it. Closing unity and reopening it seems to be a factor. If we close / reopen the editor, then do a single modification on an unrelated object, it will result in these properties getting moved around the .unity scene file.

So my questions are:

  • is anyone else running into this problem?
  • is this “by design” and basically means that the order of component properties serialization is non deterministic?
  • are there ways to prevent these types of unnecessary changes?

Yes I’ve seen that but these changes are easily merged with YAMLMerge and p4merge ignoring all whitespace characters (conflict free).

Thanks for your answer @MNNoxMortem . It is annoying as you have to perform a merge where no changes were made. If anyone else found a way to prevent these changes let me know, otherwise for now we will just deal with them manually.

@Swah you can ignore whitespace changes via git if that is what you really want. I assume any other VCS has similar settings.

@MNNoxMortem the most important change I’m seeing is not whitespace changes, but rather the order in which properties are serialized. So that options doesn’t help me (it’s on by default for us).

1 Like

I’m seeing the same thing, although it looks like it’s only in prefabs that contain nested prefabs.

Properties are being serialized in a different order even if the files are entirely unchanged. It’s causing a ton of noise in our source control.

Interesting - that could explain our problem as well, given that most our scenes have nested prefabs in them.

Could you please submit a bug-report as described in this document:

It’s important that you report these issues together with a reproduction project if you want them to get fixed. If you don’t do it, it might be a long time until someone else reports them or until Unity Technologies find them.

After you submitted the bug-report, you receive a confirmation email with a bug-report Case number. You can post the Case number (number only, not the link) in this forum thread for Unity staff to pick up, in case they see it.