Search Issue Tracker
Won't Fix
Votes
0
Found in
5.4.0f3
Issue ID
871740
Regression
No
Private variable's value from Serializable class persist when exiting play mode, instead of resetting to defaults
To reproduce:
1. Open attached project "EditorBugSerialValues.zip"
2. Open and Play "test" scene.
3. Press "+ 1" button few times.
4. Stop Play mode.
5. Press Play again.
Expected result: Value would be reset between play sessions.
Actual result: Value is saved.
Reproducible: 5.3.7p1, 5.4.4p4, 5.5.1p4, 5.6.0b10, 2017.1.0a2, 2018.3.0a6
This happens only in Editor. When project is built, it will save the value only between scenes, but not between play sessions.
Workaround:
Make the class not "Serializable", or make the value public instead of private.
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
- GameObjects change Hierarchy order when undoing adding Component to multiple GameObjects
- [macOS] Editor crashes after entering Play mode with overlapping GameObjects with Cloth Component and Cloth Inter-Collision enabled
- Look Dev constantly regenerates the default Volume Profile when set to "None" instead of using the default one
- Look Dev errors are spammed when opening a new HDRP project when Look Dev was added to the layout in the previous project
- URP Scene Templates are not editable when first opened from the New Scene dialog
Resolution Note:
This particular case has been investigated thoroughly and we have decided, in the interests of protecting the stability and features of Unity for users that rely upon the affected versions, to not address this fix for the time being. We understand that this will cause problems for some users, and so may address in a future version.