Search Issue Tracker
Fixed in 2018.1.X
Won't Fix in 2017.4.X
Votes
1
Found in
5.3.3p2
Issue ID
778588
Regression
No
RequireComponent causes components on prefabs to be duplicated on play
Reproduction steps:
1) Open user's attached project
2) Open "TestScene"
3) Select "PrefabInstanceWithColliderReplaced" prefab in hierarchy to see components' (especially colliders) behavior
4) Start scene
Prefab which bugs reproductions steps:
1) Create a new game object.
2) Add a BoxCollider2D.
3) Add the ScriptRequiringCollider2D component I have attached to my bug
report.
4) Create a prefab out of this game object.
5) Instantiate another copy of this prefab into the scene.
6) Add another collider that will satisfy the component dependency, say,
PolygonCollider2D.
7) Remove the original BoxCollider2D from the prefab instance.
8) Play.
Note:
The more you starting scene and ending, more errors and colliders you get.
Note 2:
Works only with users attached prefab (watch attached gif).
Note 3:
Bug appears on both 3D colliders and 2D.
Expected result:
If component exist on object, shouldn't create a copy of it.
Actual result:
Creates as many copies of component as many times scene has been started.
Also sends error on start and stop scene:
"Error removing component when merging prefab changes: Can't remove BoxCollider2D because ScriptRequiringCollider2D (Script) depends on it"
Reproduced with:
5.0.4f1, 5.1.4f1, 5.2.4f1, 5.3.0f4, 5.3.3p2, 5.3.3p3, 5.3.4f1, 5.4.0b8, 5.4.0b10
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Memory leak when a lot of UI elements are spawned and despawned
- Warnings are not logged in the Console window when using external code analyzers
- Errors “TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations, size 288“ appear constantly when Prefab is open
- Crash on PPtr<Shader>::operator or NullException errors spammed in console when calling Dispose() on null GraphicsBuffer with baked Reflection Probes
- “EndRenderPass: Not inside a Renderpass” and other Render Graph errors in the Player when Render Graph is enabled and Overlay UI is used
Add comment