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
- Shadows are not visible in Player when using DX12 with Forward+ or Deferred+ rendering in URP
- Rendering Debugger Playmode debug UI scrolling is jittery when using click and drag to scroll
- Frame Debugger Target Selection Search Results window becomes too tiny to even see the default “Editor” selection when there are no search results
- Async method in Play Mode being aborted when calling `new System.Windows.Forms.Form`
- Animator window Eye button on click visual does not cover the whole area of the button when clicked
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.