Search Issue Tracker
Fixed in 2022.1.X
[Other] Recorded large 'int' values in AnimationClip are not preserved
How to reproduce it:
1. Open attached project '1278866.zip'
2. Load '[Test] Record Clip' from 'Assets' folder
3. Enter Play mode and let this scene play until it ends
4. Check recorded values in the Console window
5. Load '[Test] Play Clip' from 'Assets' folder
6. Enter Play mode
7. Check observed values in the Console window
Expected result: 'Test Animation Clip' AnimationClip preserves large 'int' value and prints the same value as recorded
Actual result: 'Test Animation Clip' AnimationClip doesn't preserve large 'int' value and prints the different value
Reproducible with: 2018.4.28f1, 2019.4.13f1, 2020.1.10f1, 2020.2.0b8, 2021.1.0a2
- 'Test Animation Clip' prints '-869495424' instead of recorded int value - '-869495431'
- 'Test Animation Clip' AnimationClip preserves large 'double' and other types of value
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- TreeView Child display toggle styling becomes reversed when clicking and dragging it
- Null is returned when using FocusOutEvent.relatedTarget
- Unity_BaseInstanceID is always zero when rendering multiple meshes and instancing with the same buffer
- UI Document button's text does not resize relatively when size in percentage (%) is used
- Event.current.mousePosition has an offset of 1px along the y-axis in WebGL build when the mouse button is released
Resolution Note (fix version 2022.1):
Fixed in 2022.1.0a12
Int curves are not supported in animation clip, see here: https://docs.unity3d.com/2021.2/Documentation/Manual/animeditor-AnimationCurves.html for a list of types that are supported.
Under the hood, int values are converted to float values, so for numbers above 16777216, there is an imprecision.
You can see that the bug is caused by a float conversion using this website: https://www.h-schmidt.net/FloatConverter/IEEE754.html
Entering '-869495431' yields the expected '-869495424' value.
Update : It only works for discrete attribute int now.
This means Enum types will work, as well as the types that have the attribute [discreteAttribute]