We were getting the following error message that was causing a hard crash in Unity3D.
Prefab has multiple Transform components! Removing them automatically would not be safe.
UnityEditor.AssetDatabase:Refresh(ImportAssetOptions)
UnityEditor.AssetDatabase:Refresh()
In the rush of a milestone delivery, we narrowed it down to a particular Prefab and verified that when a user received the error, doing a Perforce “Force Sync” would prevent the asset from causing a crash. Later, when upgrading to a new version of Unity, we got the same error during the upgrade, resulting in the file being skipped and requiring a manual reimport.
Multiple Transforms? How?
Okay, so how is it possible for one of our prefabs to have multiple Transform components?
A little more investigation revealed that a developer’s use of Perforce merge changes (resolve conflicts) was actually the culprit. That is, when merging changes in the prefab (a text-based YAML file), the merge actually duplicated the transform instead of replacing the previous.
This is both totally understandable and surprising that it doesn’t happen more often. A nice reminder that merging prefabs can be dangerous (since Perforce merge-logic isn’t written for merging YAML.)
Here’s to hoping this helps anyone else encountering the same error.
For more topics on 2D graphics programming, be sure to check out my book, 2D Graphics Programming for Games available now both online and through your favorite independent bookseller.
2 comments on “Unity | Error – Prefab has multiple Transform components!”
Thanks, your post help me in hunt for this error.