Search Issue Tracker
By Design
Votes
0
Found in
2022.3.63f1
6000.0.50f1
6000.1.6f1
6000.2.0b4
Issue ID
UUM-107967
Regression
No
Animation does not control the property of the Gameobject when the keyframe and initial value are the same
How to reproduce:
1. Open the “TestProject.zip” project
2. Open the “SampleScene”
3. Enter the Play Mode
4. Select the cube GameObject in the Scene view
5. Try moving the GameObject
Expected Result: The cube cannot be moved
Actual Result: The cube can be moved
Reproducible in: 2022.1.0a1, 2022.3.63f1, 6000.0.50f1, 6000.1.6f1, 6000.2.0b4
Reproduced on: Windows 11 Pro (24H2)
Not reproduced on: No other environment tested
Workaround: Disable and reenable the parent GameObject
Notes:
- If the starting and ending position keyframes are the same, it will not contain the object in that position
- If there’s even the slightest discrepancy between the two keyframes, this will not reproduce
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
- Build fails when building a project containing an 18+ dimension array with IL2CPP
- [Android][Sentis] Human poses are not detected when using the BlazePose model
- Sprite Editor Outline Tool Overlay is not displayed when no Sprite is selected
- “No method with RuntimeInitializeOnLoadMethod attribute” warning from ReadmeEditor.cs is thrown after installing Project Auditor Rules
- Projection matrix is altered when using RasterCommandBuffer.ClearRenderTarget on DX12 and Metal
Resolution Note:
Hi,
This isn’t a bug, it’s actually an optimization feature in Unity’s animation system.
Unity uses Constant Clip Sampling Optimization to skip constant keyframes if the object’s starting position matches the clip value. That’s why the cube can be moved when the starting position matches the animation. If the starting position doesn’t match (e.g., moving the cube and THEN disabling/re-enabling the parent), the animation locks the cube in place because the constant optimization is ignored.
Workaround:
If you want the cube locked no matter what:
Click on the GameObject with the Animator component.
Look at the Animator in the Inspector.
Switch the Inspector to Debug Mode:
Click the three dots in the top-right corner of the Inspector (it’s set to Normal by default).
Select Debug.
Back in the Animator component, you’ll see new options. Set Allow Constant Clip Sampling Optimization to false.
Alternatively, tweak the animation clip by adding a tiny difference between the start and end keyframes to disable the optimization.
Let me know if you need more info!