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
- Sub-asset UI does not refresh when undoing Renderer Feature add or remove actions in a URP Renderer asset
- Scene flickers with a green tint when using Screen Space Ambient Occlusion and Contact Shadows with raytracing
- Scripts with null Components on GameObjects are not removed when calling GameObjectUtility.RemoveMonoBehavioursWithMissingScript
- Color Curve Key values remain visible after changing Curve type
- Selection highlight is drawn in an Animation Window when clicking in another Animation Window after highlighting items in the first one
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.