Search Issue Tracker
By Design
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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);