Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4
2020.1
2020.1.17f1
2020.2
2021.1
2021.2
Issue ID
1315670
Regression
No
Changes made to Prefab's variable values in a custom EditorWindow get reverted when entering the Play mode
How to reproduce:
1. Open the user's attached project
2. Open 'SampleScene'
3. In the top bar menu select Example > Example Window
4. In the Example Window toggle the 'Use Start Time' checkbox
5. Enter the Play mode
6. Observe the Example Window
7. If the issue doesn't reproduce repeat steps 4-6 (usually reproduces on the second try)
Expected result: The 'Use Start Time' checkbox state doesn't change
Actual result: The 'Use Start Time' checkbox state gets reverted
Reproducible with: 2018.4.32f1, 2019.4.21f1, 2020.1.17f1, 2020.2.6f1, 2021.1.0b8, 2021.2.0a6
Notes:
- The issue is not reproducible after unpacking the ExampleScript 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
- Crash on JobQueue::HasJobGroupIDCompleted when closing the Editor while in Play mode on a specific project
- In "Preferences" section the “SpriteShape” menu item, the details page title “SpriteShape”, and “ControlPoint” entries are displayed as code strings rather than formatted UI strings
- Errors thrown constantly when Virtual Offset Debug is enabled and lighting was baked on AMD machine
- Persistent Memory Leak when reloading domain and using Distance-based Ghost Importance
- HDRP project doesn't render in standalone player when using High stripping
Resolution Note:
When setting properties directly in the ExampleWindow (without using SerializedProperty) extra care have to be taken for overrides on Prefab instances to be recorded. There are two options here:
1) Ensure to call PrefabUtility.RecordPrefabInstancePropertyModifications(yourChangedObject) after changing properties.
2) Or call EditorUtility.SetDirty(yourChangedObject). This will indirectly call RecordPrefabInstancePropertyModifications at the end of frame for all dirty objects.
When going into Play mode the current open scene saved, so it can be reloaded after play mode, and then loaded again. When loading all Prefab instances will be merged and their overrides setup, but if overrides was not recorded properly then the state will appear wrong..
Note that when changing the toggle in the Inspector the state is correct in Play mode, but when using the ExampleWindow UI where RecordPrefabInstancePropertyModifications is missing the state is incorrect.