Search Issue Tracker
Won't Fix
Votes
0
Found in
2019.4
2020.3
2020.3.17f1
2021.2
2022.1
2022.2
Issue ID
1378365
Regression
No
FormerlySerializedAs Attribute doesn't save the serialized value when properties are used
How to reproduce:
1. Open the attached "case_1378365" project
2. Open the "Test" Scene
3. Select the "TestObj" GameObject in the Hierarchy
4. Set the "MyStringProperty" to any value that's in the "Serialized Property Example" Component in the Inspector
5. Rename the "MyStringProperty" variable to any name
6. Observe the renamed "MyStringProperty" value in the Inspector
Expected result: The "MyStringProperty" value is serialized and the renamed variable value is the same as what was set at the 4th step
Actual result: The renamed "MyStringProperty" value is an empty string
Reproducible with: 2019.4.35f1, 2020.3.27f1, 2021.2.9f1, 2022.1.0b4, 2022.2.0a2
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note:
Currently we do not support officially properties serialization. If you want FormerlySerializedAs to work on a backing field of a property you need to put in the name of the backing field: [field: SerializeField, FormerlySerializedAs("<MyStringProperty>k__BackingField")] , you can observe those names in the yaml file when saving your content in Unity Editor. Hope this helps.