Search Issue Tracker
Fixed in 2021.2.X
Votes
0
Found in
2020.2
2020.2.0f1
2021.1
2021.2
Issue ID
1304102
Regression
No
DontSaveInEditor and NotEditable flags are not automatically added to the Asset when using OnPostprocessPrefab method
Reproduction steps:
1. Open the user's attached project
2. In the Project window, select SamplePrefab
3. In the Inspector window, observe the values of Sample Property 1 and Sample Property 2
4. Select Open Prefab and observe the values of Sample Property 1 and Sample Property 2
5. In the Project window, select SamplePrefab again and change Sample Property 2 value to Test (or anything else)
6. Save the changes and select Open Prefab
7. Observe the values of Sample Property 1 and Sample Property 2
Expected result: Sample Property 1 is "original value" and Sample Property 2 is "Test"
Actual result: Sample Property 1 is "processed value 1" and Sample Property 2 is "Test"
Reproducible with: 2020.2.0a10, 2020.2.2f1, 2021.1.0b2, 2021.2.0a2
Could not test with: 2018.4.31f1, 2019.4.19f1, 2020.2.0a9 (OnPostprocessPrefab() is not triggered and does not have an effect on non-original prefab)
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
- Highlighter.Highlight does not find window when using class name as window title
- Highlighter.Highlight highlights a different component when multiple components have the same property path
- Highlighter.Highlight does not find elements in an array or list when the array or list is collapsed
- [URP][NRP] RenderPass, BeginSubPass, and EndRenderPass errors are thrown when Native RenderPass is enabled
- D3D11 swapchain error pop-up appears and the Editor shuts down when Generating Lighting with Probe Volumes present
Resolution Note (fix version 2021.2):
The behavior is correct, documentation says:
The postprocessor can set or modify hideflags on objects in the Prefab. Asset objects always get the DontSaveInEditor and NotEditable flags added. GameObjects and Components always get the DontSaveInEditor flag added. The DontSaveInEditor flag is always set to avoid the object from being saved back into the Prefab source asset, because this duplicates the generated objects every time the Prefab is saved.
https://docs.unity3d.com/2020.2/Documentation/ScriptReference/AssetPostprocessor.OnPostprocessPrefab.html
The fix for this was typos in the Documentation.