Search Issue Tracker
Fixed in 2023.1.0a6
Fixed in 2022.2.X, 2022.2.0b15, 2023.1.X
Votes
2
Found in
2022.2.0a13
2022.2.0a14
2022.2.0a18
2022.2.0a19
Issue ID
UUM-8049
Regression
Yes
Getting error 'InvalidCastException' and unable to move Key Frames in Animator when using 2D sprites from sliced sheet
How to reproduce:
- Create new 2D Core project
- Add any 2D Sprite Sheet somewhere in the Project panel (e.g. Assets folder)
- Select added Sprite Sheet and in Inspector select Sprite Mode : Multiple and click Apply button
- Click Sprite Editor button > Slice > Slice > Apply
- In Hierarchy create new object (2D Object > Sprites > Square)
- Select created object and in top menu open Window > Animation > Animation
- In Animation window click Create (and save animation)
- Drag and Drop three sliced sprites into Animation window
- Try moving added keys left or right
- Check console for errors
Expected results: No error in console. It should be possible to move key frame left/right.
Actual results: Unable to move key frames in Animation window and multiple errors are thrown in the Console window if trying to do so.
{noformat}
InvalidCastException: Specified cast is not valid.
UnityEditorInternal.AnimationWindowKeyframe.ToKeyframe () (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
UnityEditorInternal.AnimationWindowCurve.ToAnimationCurve () (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
UnityEditorInternal.AnimationWindowUtility.CreateRendererForCurve (UnityEditorInternal.AnimationWindowCurve curve) (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
UnityEditorInternal.AnimationWindowUtility.GetCurveWrapper (UnityEditorInternal.AnimationWindowCurve curve, UnityEngine.AnimationClip clip) (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
UnityEditorInternal.AnimationWindowState.get_activeCurveWrappers () (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
UnityEditor.AnimEditor.UpdateCurveEditorData () (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
UnityEditor.AnimEditor.UpdateSelectedKeysToCurveEditor () (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
UnityEditor.AnimEditor.SaveCurveEditorKeySelection () (at <dcc76d87233943b9b3b3c6ef6c77cdbf>:0)
{noformat}
Reproducible on: 2022.2.0a13, 2022.2.0a14, 2022.2.0a18, 2022.2.0a19
Not reproducible on: 2022.2.0a12
Notes: Tested on Win11
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
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note (fix version 2023.1):
https://ono.unity3d.com/unity/unity/pull-request/145480/_/animation/fix-pptrcurve-keyframes