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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.