Search Issue Tracker
By Design
Votes
0
Found in
2018.3.0a6
2019.1.0a1
2019.1.0f2
2019.2.0a1
2019.3.0a1
Issue ID
1153192
Regression
Yes
[RequireComponent] can cause duplicate components to be created on prefabs
How to reproduce:
1. Create a new Unity project
2. Create a GameObject
3. Add the Animator component
4. Save that object as a prefab
5. Instantiate this prefab in a scene
6. Remove the Animator component on the instance (it will be marked as Animator (Removed))
7. Add a new component that has the attribute [RequireComponent(typeof(Animator))]
Expected result: only one Animator Component is on the GameObject instance
Actual result: a new Animator component that cannot be removed is added and one cannot revert the removed Animator component from the instance
Reproducible with: 2018.3.0a6, 2018.4.1f1, 2019.1.3f1, 2019.2.0b3, 2019.3.0a3
Not reproducible with: 2017.4.27f1, 2018.3.0a5(Uses the old Prefab system)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
There can be only one Animator component on a GameObject at a time, so the removed one cannot be reverted (which recreates it) while there is a new one. At the same time, the new one can’t be removed as long as there is another component, which requires it. These things are both by design. To remove the new Animator and reinstate the old Animator, you will have to first remove the component which requires the Animator. Then you can remove the new added Animator and revert (reinstate) the removed original Animator. There is not a feature to be able to do this without removing the component that depends on an Animator.