Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2020.3.X, 2021.1.X

Votes

5

Found in

2020.2.0a19

2020.2.0b6

2021.1

Issue ID

1284595

Regression

Yes

Instanced Prefab gets a Component added when entering the Play Mode after deleting the script with RequiredComponent attribute

Inspector Framework

-

How to reproduce:
1. Open the attached "1284595_Repro" project
2. Open the Scene "SampleScene"
3. Open the "Comp" Script (found in the Assets folder) and uncomment the 4th line
4. Drag the "Cube" GameObject from the Hierarchy to the Project window to make it into a Prefab
5. Open the Inspector (Window->General->Inspector)
6. In the Hierarchy select the "Cube" GameObject
7. In the Inspector delete the "Comp" Script and Rigidbody Components
8. Enter the Play Mode

Expected results: The Rigidbody Component is not added
Actual results: The Rigidbody Component is added, the "Error removing component when merging Prefab changes: Can't remove Rigidbody because Comp (Script) depends on it" error is thrown

Reproducible with: 2020.2.0a19, 2020.2.0b11, 2021.1.0a5
Not reproducible with: 2018.4.29f1, 2019.4.14f1, 2020.1.13f1, 2020.2.0a18

Notes:
- If a Component was added to the GameObject before it was turned into the Prefab the issue will not occur
- Any instance of the Prefab will have this issue

  1. Response avatar

    Resolution Note (fix version 2021.2):

    Fixed in 2021.2.0a9

  2. Response avatar

    Resolution Note (fix version 2021.1):

    Fixed in 2021.1.1f1

  3. Response avatar

    Resolution Note (fix version 2020.3):

    Fixed in 2020.3.4f1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.