when i run my scene in editor, console output below error:
“Error removing component when merging prefab changes: Can’t remove MeshRenderer because TextMesh depends on it”.
yeah, i have been tried to remove meshRenderer on a gameObject which has a TexMesh on it. but i failed and then i removed the TexMesh first before i removed the meshRenderer. i am sure now there is no TexMesh in the scene.
so i can not understand why i got this error.
and i also want to know if this error will affect the Xcode project imported from unity.
This is an old post but to anyone that comes here through Google as I did I had a similar issue that I managed to fix.
Basicaly I had modified a gameObject created from a prefab, so the gameObject and the prefab had differencies. It seems to confuse Unity, so I updated the prefab to match the gameObject state (buttton “Apply” on the “Prefab” field of the gameObject) and it fixed the issue. Alternatively one could break the prefab instance of the gameObject (select the gameObject, got to “GameObject” menu, click “Break Prefab Instance”).
Hope this can help.
This bug is back and I had to remove the ‘requires component’ out of our code to get it building again. I did narrow it down to a scene that had no change in a long time so this problem was likely reintroduced through Unity’s end with the 2020.3.2f1 update (or a slightly earlier one.) If anyone has a better solution please let me know.
I got this error and couldn’t find the offending prefab in my project with many scenes. This is how I find the offending Prefab, I check the Editor Log and find the last scene the Editor opened before it report “Build completed with a result of ‘Failed’” (or search for ‘Error removing component when merging Prefab changes’)
Opening scene 'Assets/_Project/Scenes/EmojiPicker/EmojiPicker.unity'
Unloading 7 Unused Serialized files (Serialized files now loaded: 0)
Error removing component when merging Prefab changes: Can't remove Canvas because GraphicRaycaster (Script) depends on it
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
...
[./Editor/Src/Prefabs/PrefabMerging.cpp line 476]
...
Build completed with a result of 'Failed' in 12 seconds (12286 ms)
from there I find the prefab in scene EmojiPicker.unity and fix it as @quentin_le_guennec’s answer says