Search Issue Tracker

Fixed

Fixed in 2022.2.0b15, 2023.1.0a6

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

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.