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
- Editor freezes briefly when "multi-selecting" TextMeshPro GameObjects In the Hierarchy window in Prefab Mode, if 5 or more Inspector windows are open
- OnEndDrag event not triggered when losing Editor focus during simultaneous Left and Right mouse drag
- Texture displays visual artifacts and has a broken aspect ratio when it is imported in RGB 48-bit format
- Diagnostic Warning Resets When Navigating Away and Returning to Diagnostics Settings
- Checkbox Collides with Text in Shader Graph Preferences Settings
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.