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
- Crash on GUIManager::DoGUIEvent when focusing on the Game view window on a specific project
- Asset creation in the Project Browser is not always undone/inconsistent when the undo shortcut is pressed right after creating an asset
- JobTempAlloc memory leak warning is thrown when the Player is shut down
- Graphics State Collection warm-up does not work when using with Addressables Shaders
- "Baked Shadow Radius" field is visible but inactive when when the Shadow Type is set to "Hard Shadows" under the Light Component
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.