Search Unity

"modification.empty()" for Prefabs

Discussion in 'Editor & General Support' started by Gizmoi, Mar 27, 2015.

  1. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    When dragging certain prefabs into my scene I get the following error in the console window.

    I can't find anything obviously wrong with the prefabs in question. There are 3 prefabs I created at the same time, and 2 of them throw the error, one of them doesn't. Again, I can't see any obvious differences between them.

    Any help would be appreciated.
     
  2. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    HI,

    please file a bug report where the issue can be reproduced.

    Thanks
     
  3. Kylotan

    Kylotan

    Joined:
    Feb 17, 2011
    Posts:
    212
    I just got this today. No time to file a bug report, sorry. It was a prefab made entirely of UI components in one scene, which I dragged to the project to save as a prefab, then dragged into a new scene. Dragging it into the new scene caused the above error.
     
  4. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    247
    Just happened to me too. Created a custom logging console UI and made a prefab out of it. At first I included the whole canvas in the prefab, but then when I tried to export the prefab in a package and got this problem once, I then created an empty Object under the canvas as an intermediary between the canvas and the actual UI, which would also get a UI handling script(previously was on the canvas, handles enabling and disabling the logging console) but even that one had the modifications.empty() problem.
    In both cases I tried to make a prefab and export to a package in order to use in other projects.
     
  5. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    228
    @SteenLund , It still happens on Unity5.4 .. I created a prefab containing a script that references UI elements in its children GameObjects. When I export it to another project, the references are lost and I have to manually reassign them by hand. It's a really annoying...
    Also shows modifications.empty() error, too. Bug reported(825989)
     
  6. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I get "modifications.empty()" while instantiating a UI Prefab using "PrefabUtility.InstantiatePrefab" in Unity 5.3.4f1.
     
    boxels likes this.
  7. Suminsky

    Suminsky

    Joined:
    Aug 11, 2011
    Posts:
    50
    Just got this in unity 5.5.1f1, when dragging a prefab into the scene, theres also ui in the prefab (and lots more stuff)
     
  8. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    Got this on 5.5.2f1 just today.
     
  9. akingdom

    akingdom

    Joined:
    Mar 30, 2013
    Posts:
    15
    Got this on 5.5.0f3 today.
     
  10. akingdom

    akingdom

    Joined:
    Mar 30, 2013
    Posts:
    15
  11. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    still an issue in 5.6.0p3


    [edit]
    since it seems that there were no posted bugs submitted... I've done so here: case#: 914706
     
    Last edited: May 25, 2017
  12. carlo_montoya

    carlo_montoya

    Joined:
    Jun 4, 2017
    Posts:
    5
    Same thing happened while I'm doing the Tanks Tutorial. I was getting a Null Reference error and I noticed that the game only spawned one tank clone and only had Tank Renderers as its child. I had a hunch that the problem was with the sliders in the child Canvas. I created another tank prefab and renamed it Tank Test and removed the Health and Aim sliders and ran the game. Although there were errors related to the sliders being removed, the two tanks were spawned. I then reset the Game Manager to point to the original Tank Prefab and played the game and for some reason (I don't know why), the problem was fixed. I don't know enough about Unity to understand why removing the sliders in a similar prefab and then using the original prefab fixed the problem.
     
  13. Lorin_Atzberger

    Lorin_Atzberger

    Joined:
    Dec 11, 2013
    Posts:
    119
    Still happening in 5.6.2.f1
     
  14. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    again, a problem in editor with 5.6.2p4

    I understand that you guys have a business to run and that 2017.1 release is like.. the thing now, but 2 years in the making and no fix?

    I am really disappointed with the entire 5.x release.
     
    GraemeScott likes this.
  15. LiuQingwen

    LiuQingwen

    Joined:
    Oct 31, 2016
    Posts:
    1
    It happens to me on Unity 2017.1 too... While I was doing the Tanks tutorial...:(
     
  16. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    Happening also for me when upgrading text mesh pro with unity 5.6.4f1 .. was fine with the version with unity 5.6.3.
    Not sure if someone is looking into it.
     
  17. Jbrandan

    Jbrandan

    Joined:
    Dec 9, 2016
    Posts:
    3
    2018.1.0b7 Lo mismo
     
  18. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    This is happening to me as well. Unity 2017.2.0f3.

    This happens 100% of the time with a certain prefab (haven't tested other prefabs, though)... unfortunately it's a huge prefab and one that I cannot share publicly.

    Here's the full call stack:

    Code (csharp):
    1.  
    2. Assertion failed: Assertion failed on expression: 'modifications.empty()'
    3. 0x00000001411B000B (Unity) StackWalker::GetCurrentCallstack
    4. 0x00000001411B288F (Unity) StackWalker::ShowCallstack
    5. 0x000000014108CA30 (Unity) GetStacktrace
    6. 0x0000000140596DA3 (Unity) DebugStringToFile
    7. 0x0000000140597581 (Unity) DebugStringToFile
    8. 0x0000000140B61B4D (Unity) AddDefaultRootTransformModifications
    9. 0x0000000140B64D18 (Unity) InstantiatePrefab
    10. 0x000000014124DE53 (Unity) PrefabUtility_CUSTOM_INTERNAL_CALL_InternalInstantiatePrefab
    11. 0x000000003E02052D (Mono JIT Code) (wrapper managed-to-native) UnityEditor.PrefabUtility:INTERNAL_CALL_InternalInstantiatePrefab (UnityEngine.Object,UnityEngine.SceneManagement.Scene&)
    12. 0x000000003E020413 (Mono JIT Code) [PrefabsBindings.gen.cs:123] UnityEditor.PrefabUtility:InternalInstantiatePrefab (UnityEngine.Object,UnityEngine.SceneManagement.Scene)
    13. 0x000000003E02009E (Mono JIT Code) [PrefabsBindings.gen.cs:113] UnityEditor.PrefabUtility:InstantiatePrefab (UnityEngine.Object)
    14. 0x000000003E01F8B4 (Mono JIT Code) [DMMMenu.cs:59] DMMMenu:SetupScene ()
    15. 0x0000000002AF0F6E (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
    16. 0x00007FFEBC5360FB (mono) [mini.c:4937] mono_jit_runtime_invoke
    17. 0x00007FFEBC488875 (mono) [object.c:2623] mono_runtime_invoke
    18. 0x000000014091D03C (Unity) scripting_method_invoke
    19. 0x00000001409119C3 (Unity) ScriptingInvocation::Invoke
    20. 0x00000001409120FE (Unity) ScriptingInvocation::InvokeChecked
    21. 0x0000000140AF7EA1 (Unity) ScriptCommands::InvokeMenuItemWithContext
    22. 0x0000000140AF80F3 (Unity) ScriptCommands::Execute
    23. 0x000000014102F58C (Unity) MenuController::ExecuteMenuItem
    24. 0x00000001412CBD6D (Unity) ProcessMainWindowMessages
    25. 0x00000001412BBC65 (Unity) ContainerWindow::ContainerWndProc
    26. 0x00007FFEF22BB85D (USER32) CallWindowProcW
    27. 0x00007FFEF22BB1EF (USER32) DispatchMessageW
    28. 0x00000001412CC2EA (Unity) MainMessageLoop
    29. 0x00000001412CDC04 (Unity) WinMain
    30. 0x0000000141DE45A8 (Unity) __tmainCRTStartup
    31. 0x00007FFEF2571FE4 (KERNEL32) BaseThreadInitThunk
    32. 0x00007FFEF4A2EFC1 (ntdll) RtlUserThreadStart
    33.  
    It seems to be coming from AddDefaultRootTransformModifications.
     
  19. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Welp, I managed to find a 100% repro case. Basically, if the prefab contains a screen space overlay canvas that's been disabled, and a child canvas that's been enabled, then this assert fails when you try to instantiate the prefab (either via drag & drop, or via script; it doesn't matter).

    I've filed a bug report with Unity with a repro project. Hopefully they'll finally be able to fix this issue for good.
     
  20. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    I am getting :

    Code (CSharp):
    1.  NOC.Awake()    <9aa37a41520c4929b79e505dad05545d>:0
    2. InternalEditorUtility.HierarchyWindowDrag()
    3. GUIUtility.ProcessEvent()
    but it is from a cube that has no gui code on it. I testing a new serializer I wanted to try and use so I just put a piece of code on it which took a variable I had in the script and went to serialize it.

    This was the code in Awake.

    Code (CSharp):
    1.             byte test = (byte)ClientOperationCode.Chat;
    2.             test1.Add(test, cube);
    3.             serial.Serializer(test, test1);
    4.             deserial.DeserializeEvent(test, test1);
    5.  
     
    Last edited: Apr 14, 2018
  21. dsalisbury

    dsalisbury

    Joined:
    Mar 5, 2018
    Posts:
    4
    I've been using Unity for about 6 years, and this is the first time I have ever seen this error after just updating to 2018.1.0f2.

    The object is a Canvas prefab with no children (attached screenshot). The error appears to not hurt anything, it is just triggers my OCD something awful.

    How can I get rid of it? I tried remaking the prefab, didn't seem to matter.

    EDIT Update: Open a new project, open a new scene, make a new Canvas object, make that canvas object a prefab, and instantiate it. Same error. The error has absolutely nothing to do with my project/prefabs.
     

    Attached Files:

    Last edited: May 14, 2018
  22. dsalisbury

    dsalisbury

    Joined:
    Mar 5, 2018
    Posts:
    4
    New project, new Canvas, new prefab, new everything. Same error. Screen Shot 2018-05-14 at 11.39.35 AM.png
     
  23. notoriouszyanga

    notoriouszyanga

    Joined:
    Jun 12, 2018
    Posts:
    1
    I solved the my issue... I was missing a Parenthesis in the c# file..
     
  24. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    Same mistake on Unity 2018.1.6 f1 while using CrossplatformInput, "DualTouchControls" prefab...
     
  25. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    The detail:

    Assertion failed: Assertion failed on expression: 'modifications.empty()'
    UnityEditorInternal.InternalEditorUtility:HierarchyWindowDrag(HierarchyProperty, Boolean, HierarchyDropMode)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  26. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    It is there in 2018.2 b9 as well. Making a canvas to prefab and dragging it to the scene throws this error !
     
  27. hewenxie

    hewenxie

    Joined:
    Jul 19, 2018
    Posts:
    1
    Modify Canvas's rendermode to "World"
     
  28. korteasy

    korteasy

    Joined:
    Jul 9, 2018
    Posts:
    3
    GUYS I SOLVED IT. IN BUİLD SETTINGS YOU SHOULD CHANGE PLATFORM TO ANDROİD/IOS FROM WINDOWS (IF YOU TRY TO USE CROSSPLATFORMINPUT PREFABS)
     
    rahmatulloheko likes this.
  29. kuperto_pixel

    kuperto_pixel

    Joined:
    Aug 30, 2016
    Posts:
    1
    Solved the issue, run the project, instantiate the prefab with the problem via script(For some reason when you instantiate the prefab, it won't throw the error) Now delete your prefab and replace it with the one in the hierarchy window.

    It worked for me, worth a try.
     
    saruya likes this.
  30. seedyan

    seedyan

    Joined:
    Dec 2, 2014
    Posts:
    5
    Hello,What is your version? My version is 2017.4.11f1, I tried your method,but it was failed.
     
  31. nyscersul

    nyscersul

    Joined:
    Oct 17, 2018
    Posts:
    136
    It seems that specifically for the double touch control interface prefab from the standard assets at least this error can be avoided. Simply manually go into the prefab components (the little button like a play button on the prefab) and then select each component and toggle their little checkbox in the top of the inspector, thereby toggling them to enabled *before* instantiating them, in my case via drag and drop. I then immediately disabled the components again.

    Still having trouble getting the other components to work tho hehehe

    the controls appear blank... But at least the compiler isnt crying at me now.
     
  32. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    This is just typical Unity comic programming quality.

    Unfortunately this opaque error can happen for a number of small reasons.

    For example we found a case where if the script exists but is in a "different place" (say, when importing from another project) it can happen.

    It will never be fixed, it will never be improved.

    Don't waste your time or breath worrying about it.
     
  33. KISP

    KISP

    Joined:
    Sep 13, 2018
    Posts:
    32
    Does this error actually affect anything? I get it all the time when I'm working with my prefabs, but it doesn't seem to have any negative effects.
     
  34. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    hi @ausernme - It seems that it does nothing.

    Notice above I mention what was causing it in "our case" - but it seems to be caused by a number of small problems.

    It seems to be harmless. You can sometimes get rid of it by just deleting/remaking the prefab(s) in question, with new names. But sometimes not.
     
  35. j04milan

    j04milan

    Joined:
    Feb 6, 2019
    Posts:
    44
    also in unity 2018.2.20
     
  36. MildlyAnnoyed

    MildlyAnnoyed

    Joined:
    Jan 12, 2017
    Posts:
    7
    Hi Steen Lund

    I'm still seeing this issue in 2018.2.21f1. I can consistently reproduce this in a fresh project by:
    1. Make a new Canvas object in hierarchy
    2. (Optional) Remove all components except the Canvas component and RectTransform from the object
    3. Save the object as a prefab
    4. Drag the prefab back into the hierarchy <-- This provokes the error

    I can inform that I'm only seeing the error at edit time. It happens both when dragging the prefab in, or when instantiating it through code (at edit time). If the prefab is instantiated at runtime, I'm NOT seeing the issue.

    When looking in the Issue Tracker I see that there's been attempts at fixing this, but there's comments on those entries indicating that some people are still seeing this. I'm wondering what I should do here? Add to the comments, or open a new issue on this?

    Do you know if what I'm experiencing is the same bug, or if this is a symptom that finds a certain group of errors?
     
  37. ztf147

    ztf147

    Joined:
    Apr 30, 2019
    Posts:
    1
    Change your Prefab' renderMode to world space so it won't report the error,Then in the Awake change it back to ScreenSpaceOverlay.it works for me.try it guys
     
  38. heronww

    heronww

    Joined:
    Sep 8, 2019
    Posts:
    30
    2019.3 beta. Just got this now as a new user. What does this mean? It's not a pretty sight.