Search Issue Tracker

By Design

Votes

0

Found in

5.4.0b12

Issue ID

784685

Regression

No

Changes made to instance of prefab aren't recorded if previously SetActive was called on that prefab

Scene Management

-

Steps to reproduce:

1. Open attached project
2. Open "Editor/ShowBug.cs" script
3. Script creates instance of prefab, then prefab has SetActive(true) called and after that sets transform.position the instance
4. Go back to editor and in top menu, click "Show > Bug"
5. Notice that instance of "GameObject" prefab is created
6. Inspect newly created instance and notice that transform.position is 0, 0, 0 although it was set to 1, 1, 1 in the script
7. In console, notice that output message states that transform.position of instance is 1, 1, 1

Additional steps:
8. In "ShowBug.cs" script, comment out SetActive(true) statement
9. In editor, create instance of prefab again and notice that this time transform.position is 1, 1, 1

Workaround: Call PrefabUtility.RecordPrefabInstancePropertyModifications for each property that was changed. Please note that calling it directly on game object is not enough: as an argument to the method you have pass "instance.transform", "instance.GetComponent<Rigidbody>()", etc.

Reproduced with: 5.1.4f1, 5.2.4f1, 5.3.4p1, 5.4.0b13

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.