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
- Search field in UI Builder's Library has no character limit
- Changing the value in UI Builder by dragging increases it by a few thousand points when reaching the borders of the screen
- ARM64 architecture DLL incorrectly copied instead of x64 when building for Windows x64
- Crash on TypeTreeIterator::GetNode when opening a specific folder
- Crash on WriteSerializedAssetsV2 when (re)entering the Play Mode in a specific project when IEnumerator Start() is used
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.