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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
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);