Search Issue Tracker
By Design
Votes
1
Found in
2019.4
2020.3
2021.1
2021.1.7f1
2021.2.0a1
2022.1
Issue ID
1344272
Regression
Yes
Animator.WriteDefaultValues does not restore default values when it is called
Reproduction steps:
1. Download and open the attached project: "Animator_WriteDefaultValues.zip"
2. Open the "AnimatorTestScene" in the Assets folder
3. Open the "Animator Controller.controller"
4. Enter Play Mode and select the "AnimatorTestObject" in the Hierarchy
5. In the Animator window press on Parameters and observe the values
6. Press on the Game view to focus on it
7. Press the space bar and observe the Animation Parameters again
Expected result: The values change to the ones before entering the Play Mode
Actual result: The values do not change
Reproducible with: 2019.4.29f1, 2020.3.16f1, 2021.17f1, 2021.2.0a1, 2021.2.0b7, 2022.1.0a5
Not reproducible with: 2021.1.0a10
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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
Resolution Note (2022.1.X):
This is by design.
WriteDefaultValues' purpose is to reset animated properties to their default values. Thus, if the controller parameters are driven by an animation curve, they will be restored to their default values when calling WriteDefaultValues. In the use case highlighted by this bug, the controller parameters are not animated.
The parameters were reset prior to Unity 2021.1.11f1 because of another bug fix that introduced this regression. It has been fixed since then and the behaviour is now what it's always been.
I recommend writing back the controller parameters yourself if you wish them to be reset instead of relying on WriteDefaultValues.