Search Issue Tracker
By Design
Votes
0
Found in
2017.4
2018.4
2019.2.20f1
2019.3
2020.1
Issue ID
1218346
Regression
No
Scriptable Object retains private bool value when recompiling scripts
How to reproduce:
1. Open the attached 'project-1218346.zip' project
2. In the Project browser select 'CustomAsset' and clear the Console window afterward
3. Modify the 'OurScriptableObject.cs' script and save changes
4. Return to the Editor, let it recompile and observe the Console window
Expected result: an error message is not printed
Actual result: an error message is printed
Reproducible with: 2017.4.37f1, 2018.4.17f1, 2019.3.2f1, 2020.1.0a24
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
- [WebGL][Android] Corrupt header when connecting via IP
- Editor and Android Player hangs/freezes when repeatedly Loading/Unloading AssetBundle in Vulkan
- Selecting a Material for HDRP Decal Projector in the Inspector window spams errors in the Console
- Expanded Asset Preview Box moves/hides when creating new Asset in Project window
- Player crashes on Meta Quest with "/apex/com.android/runtime/lib64/bionic/libc.so" when using OpenXR Plugin in a specific project
Resolution Note:
Certain ScriptableObjects fields are serialised in-memory to assist with hot reloading, this covers `private bool` fields. This allows for the fields to be retained through a domain reload, these fields do not persist to disk however (only the in-memory version of the ScriptableObject will contain these fields).
To avoid this behaviour, use the `[NonSerialized]` attribute to enforce that no serialisation is performed for both the in-memory and on disk representations of the object.