Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Prefab modifications are constantly changing serialized data order and cause version control noise

Discussion in 'Prefabs' started by Xarbrough, Aug 5, 2019.

  1. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    545
    I believe I have already seen this issue as a bug report somewhere, but cannot find it anymore. Please let me know if this is being worked on or if anyone has any ideas what to do against this:

    PrefabModificationsRandomOrder.jpg

    We are on Unity 2019 and at some point in the past a dozen of our prefabs have started changing every time the project is saved even though nobody has touched these assets. The values itself do not seem to change, but the order in which these modifications are saved to disk. This is causing a really big annoyance for us because we are working in a team and team members are constantly confused why these assets show up as changed and cause merge conflicts, when they shouldn't.

    Unity is notorious for setting files dirty even though nothing has changed, this is a well-known problem and other software such as PlasticSCM actually patches some of this up by ignoring files which have their timestamp changed, but not their content. However, in this case with prefabs, the contents change their order which causes a lot of noise in our version control system.

    Again, I believe this is a known bug, but please let me know what the status is, as I cannot find it in the issuetracker. Thank you!
     
  2. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    72
    I was just complaining about this / confirming with some other folks! We're seeing this two across multiple 2019 projects. Super annoying. We have hundreds of prefabs in our projects and this can take a long time if you want to be able to verify that no changes were made. When we see this manifest, its just taking the data we have and reordering it in the prefab, no actual changes are being made.
     
  3. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    51
    By chance, do you have auto-save enabled for prefabs?
     
  4. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    545
    No, at least not on my machine. Maybe some of our developers have it on, but the changes already happen when these specific prefabs are loaded into memory (either because a scene was openen which contains them or if they have been selected in the inspector during the editor session), and then the project is saved.
     
  5. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    545
    SpinningDonut.gif
    The problem is getting worse every week. We've now found cases were the affected prefabs are being reimported whenever anything changes in the project and can even become stuck in an import loop. I've reported an issue with reproduction case, but I'm still waiting for a reply. I believe it's rather difficult to reproduce for QA. The issue does not happen when one works on a single user machine, it requires at least two different users/computers to cause the serialization to randomly change. I assume it's mainly because the asset import is not deterministic and therefore, whenever one of my team mates opens their project, Unity imports the prefabs differently, but for unknown reasons this also changes the actual prefab files on disk. To reproduce this, one must setup a multi-user environment with version control. I've explained it in the bug report, so let's see what they say.
     
  6. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    449
    Asifno13, Xarbrough and mcarriere like this.
  7. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    545
    Thanks, that's great news! :) Is there a different issue id I can track or how will we know when the fix has landed?
     
  8. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    72
    Thanks for the update @SteenLund! (I'd also love a public issue ID for this one.)
     
  9. marcin-matczak

    marcin-matczak

    Joined:
    Sep 5, 2018
    Posts:
    2
    I confirm it happening on 2019.1.14f1 and 2018.3.6f1. It also happens in the serialized scene file in the prefab modification list. This is very annoying and slows our work down. Instead simply committing all the changes I've made I have to go through list of changes and stage chunks of real changes one by one. Please fix this.
     
  10. SeductiveMango

    SeductiveMango

    Joined:
    Jun 3, 2019
    Posts:
    1
    Happening on 2019.1.5f1. Making it neigh impossible to work on entire prefabs since it just constantly is updating.
     
  11. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    72
    @SteenLund Any updates or versions we can be looking forward to for this fix?
     
  12. Vince-Chimp

    Vince-Chimp

    Joined:
    May 28, 2018
    Posts:
    14
    I'd also be interested in a bug reference to track this. @SteenLund
     
  13. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    1,662
  14. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    74
    Happening in 2019.2.1f1 as well :\
     
  15. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    49
    Same here, exactly same behavior, ordering of modifications changes.
    In example below it's moved 50 lines up for no particular reason.

    It's big issue for us, because we use nested prefabs heavily and this change triggers reimport of all dependent prefabs, which can take minutes. Worse this happens when prefab is clicked in project, because it opens it in inspector and then it saves it right away.

    Naive approach to fixing this seems like sorting modifications by property path.

    upload_2019-10-21_16-45-34.png
     
    Jes28 likes this.
  16. Mads-Nyholm

    Mads-Nyholm

    Unity Technologies

    Joined:
    Aug 19, 2013
    Posts:
    96
    This issue has a been fixed for 2020.1 and backports are in progress.
     
  17. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    49
    Great news! Thank you!