Search Issue Tracker
By Design
Votes
0
Found in
2021.3.35f1
2022.3.19f1
2023.2.9f1
2023.3.0b6
Issue ID
UUM-62514
Regression
No
AssetPostprocessor does not update the Prefab hash and Components when it is viewed in Prefab Mode
How to reproduce:
1. Open the “postprocessor-hash” project
2. Open the Hash Viewer window (Window > Hash Viewer)
3. Open the “Assets/Test.prefab” in Prefab Mode
4. Observe the Hash Viewer window
5. From the Project window add the “Assets/MyScript.cs” script Component to the “Test” Prefab
6. In the Inspector window observe the fields of the “My Script” Component
7. Save the Prefab and repeat step 4
8. In the Project window select the “Test” Prefab and repeat step 6
9. Repeat steps 3, 4, 6
Expected result: “My Script” Component fields are automatically updated in Prefab Mode and the “Test” Prefab’s hash does not change
Actual result: “My Script” Component fields are updated after re-opening the Prefab and the “Test” Prefab’s hash changes
Reproduced with: 2021.3.35f1, 2022.3.19f1, 2023.2.9f1, 2023.3.0b6
Reproduced on: Windows 11
Not reproduced on: No other environment tested
Note: Not reproducible without the “MyScriptPrefabPostprocessor.cs” script
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
- VFX Graph Memory leak when calling the ClearPropertyBinders and AddRemoveVFXProperty
- Entering "Configure Avatar" inside the Inspector locks it
- [Render Graph Viewer] Resource list icons cropped and in inconsistent positions
- Scene View with Debug Draw Mode enabled is gray when GPU Resident Drawer is enabled
- The UI is not visible when resizing out of focus built Player window with Application.runInBackground set to false
Resolution Note:
Thank you for reporting a bug to Unity.
To quickly summarise, you are observing the correct behaviour:
* When the scrip is added you then see a new hash of the prefab with the script and default values
* The project browser inspector view of the prefab shows the 'in-memory' changes to the script's fields that were made during the post process callback (21, valid material), but these are not yet saved to disk
* The file on disk shows the default values in the YAML, and the prefab stage view reflects this
* Saving the dirty script (it's actively set dirty in the post process callback) saves the data to disk, and all views of the prefab show the updated values (21 etc)
The prefab stage always shows the on-disk version of the prefab, so in this case we are observing the correct behaviour. We understand it could be confusing to the user that the two inspector views don't show the same data.
We hope this helps explain why today we will be closing this case. Thank you again for taking the time to report this issue, and please let us know if there is anything else that changes the impact or severity of this issue.