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
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
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Overlay Image gets darker on each Camera when multiple Cameras are used
- Assertion failed on expression: 'scriptedImporterClass == SCRIPTING_NULL error when opening the standalone profiler window
- Disabled assets in Import Unity Package window aren't tracked but count as being selected by user
- [Windows] Crash on GetManagerFromContext when video is playing and creating High Definition 3D Projects after FMOD failed to switch back to normal output Error appeared
- GC Alloc produced when adding items to MultiColumnListView with Auto Assign Binding
Resolution Note (2018.3.X):
It is by design. Reference: https://docs.unity3d.com/ScriptReference/PrefabUtility.RecordPrefabInstancePropertyModifications.html