Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Unity 2018.3.10f Nested Prefabs Unpacking then Packing back causing errors

Discussion in 'Prefabs' started by FernandoHC, Apr 1, 2019.

  1. FernandoHC

    FernandoHC

    Joined:
    Feb 6, 2018
    Posts:
    310
    Hello all,

    I've been doing some research on this but to no avail so far, so before I go through the bug posting process (which will require a lot of effort on my side to repro in another project). I wanted to check out if anyone else is having issues when unpacking prefabs, and then packing them back to the original?

    When packing an instance of a prefab back to its original on the Projects folder, several objects go missing from it (they are simply deleted from the instance AND from the prefab), so the only way to get them back is by pulling a back up. Luckily I work with git so that's not an issue for me, but people working on standalone projects might lose data like that with no chance of getting it back.

    I get the following errors when doing so:
    Code (CSharp):
    1. Assertion failed on expression: 'm_UsedFileIDs.count(fileID) == 0'
    2. UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag()
    3. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    4.  
    5.  
    6. CheckConsistency: Transform child has another parent
    7. UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag()
    8. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    9.  
    10.  
    11. Failed to load component (RectTransform)! Removing it!
    12. UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag()
    13. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    14.  
    15.  
    16. It is not allowed to set DontSaveEditor or DontSaveInBuild on a Transform component, unless it has already been set on the GameObject.
    17. UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag()
    18. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    19.  
    20.  
    21. Transform component could not be found on game object. Adding one!
    22. UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag()
    23. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    24.  
    25.  
    26. Prefab has multiple Transform components! Removing them automatically would not be safe.
    27. UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag()
    28. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    The issue started happening after a while using a particular prefab (which is a quite complex UI panel system), just by unpacking and packing it back the top 2 errors are thrown.

    I was able to repro the issue by exporting and importing in a new project on 2018.3.10f, but due to the complexity of the required dependencies, preparing a proper bug report build would take hours, just wanting to avoid that for now.

    The only workaround for this issue is to actually make a new prefab from the instance, doing that solves the packing issue from then on. But it's not really a solution because the references for the prefab will have to be manually repaired.
     
    joaobsneto likes this.
  2. joaobsneto

    joaobsneto

    Joined:
    Dec 10, 2009
    Posts:
    144
    Same issue in 2018.3.12f1.
     
  3. ryanmillichap

    ryanmillichap

    Joined:
    May 15, 2019
    Posts:
    1
    Had the same issue, updated Unity hub to the latest version and then used the latest version of Unity. The error then changed to transform child parents something or other. Double clicking the error opened the prefab responsible for the error then I just closed it again without making any changes. This cleared the error and now my project compiles fine :). I don't know if this will help you but hopefully it will.
     
  4. FernandoHC

    FernandoHC

    Joined:
    Feb 6, 2018
    Posts:
    310
    Aye @ryanmillichap , we updated to 2018.3.14f and still get this error occasionally, with the error message
    CheckConsistency: Transform child has another parent
    , there is no stack trace, so we can't pinpoint where it originated from.

    However, going to the prefab and clicking to apply changes seems to solve the issue and stop the error message being thrown every time the game starts.

    But to be clear, this is still an issue and we're still losing objects, even though the error is not thrown, we lost references on the prefab. And as we can't reproduce this consistently, we can't provide an example project.
     
  5. devon_unity433

    devon_unity433

    Joined:
    Aug 2, 2018
    Posts:
    2
    Also got these problems. I deleted the offending objects inside my prefab and the error stopped showing on saving the prefab.

    Random.
     
  6. BazookasZerreth

    BazookasZerreth

    Joined:
    Dec 8, 2016
    Posts:
    17
    Same with nested UI prefabs on Unity 2019.1.3f1. Renaming the added gameobject in the prefab "Background1" to "Background2", thus making the name unique in the prefab hierachy seems to solve the issue sometimes, but it will likely popup again as it infects the prefab somehow. It's highly annoying as I'm forced to rebuild prefabs to permanently fix it. Copy pasting between prefabs seems to trigger it. Seems like something for @runevision to look into.
     
    Last edited: May 23, 2019
    FernandoHC likes this.