Search Issue Tracker
By Design
By Design in 2023.1.X
Votes
0
Found in
2020.3.40f1
2021.3.13f1
2022.1.22f1
2022.2.0b14
2023.1.0a18
Issue ID
UUM-19289
Regression
No
The Prefab instance values are not saved when resetting them with the custom button in the Inspector
Steps to reproduce:
1. Open the project “Unity 2022.1.19f1 - Custom editor button changing vector list on prefab instance lets 0 revert on Play Exit”
2. Open the “SampleScene” Scene
3. Select “ListOfPoints” GameObject in the Hierarchy
4. Click the “Reset all values to zero” button in the Inspector
5. Enter Play mode
6. Observe the Inspector
Expected result: The values remain 0
Actual result: Some values changed back to 99 (The changed values are the ones that are 0 in the original Prefab)
Reproducible with: 2020.3.40f1, 2021.3.13f1, 2022.1.22f1, 2022.2.0b14, 2023.1.0a18
Reproduced on: macOS Monterey 12.5.1 (Intel)
Notes:
- Git also does not track the values reset
- Not reproducible with “ListOfPoints (1)” GameObject because it is a non-prefab instance
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
- Animator state transition preview clips are flickering when zooming in
- [Tile Palette] Sprites not rendering when brush tool "Paint a filled box with active brush" is used for the first time
- Adding available Nodes with longer names in Fragment Context window overflow Fragment Context window in Shader Graph
- Longer Shader Graph Property Reference names breaks VFX Graph Output Particle Node
- "DebugAllocatorMode" option changes when changed in another Editor instance
Resolution Note:
Hi, please check out the documentation for recording undo on Prefab instances. Following the example will make entering Play mode work correctly.
https://docs.unity3d.com/ScriptReference/PrefabUtility.RecordPrefabInstancePropertyModifications.html
It should follow this pattern:
Undo.RecordObject(script, "Reset all values to zero");
//Set values here
...
PrefabUtility.RecordPrefabInstancePropertyModifications(script);
Resolution Note (2023.1.X):
Hi, please check out the documentation for recording undo on Prefab instances. Following the example will make entering Play mode work correctly.
https://docs.unity3d.com/ScriptReference/PrefabUtility.RecordPrefabInstancePropertyModifications.html
It should follow this pattern:
Undo.RecordObject(script, "Reset all values to zero");
//Set values here
...
PrefabUtility.RecordPrefabInstancePropertyModifications(script);