Search Unity

Feedback Non-deterministic ordering of PrefabInstance.m_Modification.m_Modifications

Discussion in 'Prefabs' started by OndrejP, May 20, 2019.

  1. OndrejP


    Jul 19, 2017
    See attached screenshot of Git diff.
    What you see is PrefabInstance with modifications, but their order has changed (yes, it's same prefab instance spanning over 2000 lines)

    It happens a lot that for some reason Unity decides to reorder prefab modifications.
    This has no implications for Unity itself, but it creates "fake" changes when there are none in fact.
    What's more annoying is that when multiple people do some minor changes to prefabs (e.g. changing single value), it can very easily create merge conflicts.

    Oh and it has some Unity implications, it triggers reimport of prefabs which depends on it, which in our case can take few minutes!

    Would it be hard to sort modifications by "target" (file id or rather guid) then by "propertyPath"?
    This seems like obvious solution, while I might be missing something.
    Should I file this as a bug?

    Attached Files:

    mcallet likes this.
  2. SteenLund


    Unity Technologies

    Jan 20, 2011
    We do exactly this and have been doing so since an early beta of 2018.3

    Loading a scene from a previous version of unity and then saving it would cause the modifications to be shuffled but then it should stop.

    If it still happens I would like to have a bug report with a simple project that reproduces the issue.
    OndrejP likes this.
  3. OndrejP


    Jul 19, 2017
    We're using Unity 2019.1.3, so this might happened when scene was saved in 2019.1.2 and then opened in 2019.1.3?
    Or does it have to be bigger change (e.g. 2018.3 to 2019.1?)

    To understand that correctly the screenshot above changed it from "correct" to "wrong" or from "wrong" to "correct"?

    This is my understanding
    1) GUIDs are the same for everything on screenshot
    2) FileIDs is different

    It ordered modifications by FileIDs like this:

    Code (CSharp):
    1.     1510454531525924473
    2.     298446158979222321
    3.     7717507489988919440
    Which does not make any sense to me (unless it uses "string" comparison instead of number comparison).
    Could it be that on different machine it can use different sorting? (e.g. natural sort which orders number strings differently).
    Last edited: May 23, 2019