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
- 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 (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.