Search Issue Tracker

By Design

Votes

0

Found in

2021.3.11f1

2022.1.21f1

2022.2.0b13

2023.1.0a17

Issue ID

UUM-18224

Regression

No

Reserialized values are lost after removing the FormerlySerializedAs attribute

--

-

Reproduction steps:
1. Open the user’s attached project "kun.zip"
2. Select the “Worm” GameObejct in the Hierarchy
3. Expand and observe the values under "Stats" in the Inspector window
4. Open UtilityAIAgent.cs in a Script editor
5. Rename “AIStatConfiguration[] Stats” to “stats”
6. Add “[FormerlySerializedAs ("Stats”)]” above the variable
7. Return to the Editor
8. Return to the script and remove the “[FormerlySerializedAs ("Stats”)]”
9. Return to the Editor
10. Observe the "Stats" in the Inspector window

Expected result: the "Stats" are populated like they were at step 3
Actual result: the "Stats" are empty

Reproducible with: 2021.3.11f1, 2022.1.21f1, 2022.2.0b13, 2023.1.0a17
Could not test with: 2020.3.41f1 (Script compilation errors)

Reproducible on: macOS 12.4 (Intel)

  1. Resolution Note:

    If you believe this is a regression, please provide versions where this issue wasn't reproducible.

    FormerlySerializedAs works at load time to provide an alias to a part of a property path. It does not unfortunately automatically re-serialize all object instances containing those fields. This allows to have PropertyModifications and Animation targeting the old/new value and still working.

    We are looking at expanding our offering in the area of data migration in the future.
    You can find the item in https://unity.com/roadmap/unity-platform/engineering
    See:
    https://portal.productboard.com/z8pw2ms6jxytyez9chlmm4kr/c/578-c-serialized-data-migration

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.