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

Scripting

-

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.

  1. 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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.