Hello Guest

Author Topic: SpriteAnimation crash if images missing from a Sprite collection  (Read 3777 times)

Martin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 17
    • View Profile
If I delete or change the sprite collection the animation is referring to, there is no way to fix it as the Animation editor disappear and the console spam errors. Would it be possible in case of missing frame to keep the animation clip but just reset the collection or clip it tries to refer to?

Edit: I could get the SpriteAnimation to work again by opening the .prefab in a text editor and deleting the clip with the missing frames.

IndexOutOfRangeException: Array index is out of range.
tk2dEditor.SpriteAnimationEditor.TimelineEditor.DrawFrameGroupEx (Rect r, .tk2dSpriteAnimationClip clip, tk2dEditor.SpriteAnimationEditor.FrameGroup fg, Boolean highlighted, Boolean showTime, Boolean playHighlight) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:525)
tk2dEditor.SpriteAnimationEditor.TimelineEditor.DrawFrameGroups (Int32 controlId, Rect frameGroupRect, .tk2dSpriteAnimationClip clip, System.Collections.Generic.List`1 frameGroups, Single clipTimeMarker) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:211)
tk2dEditor.SpriteAnimationEditor.TimelineEditor.Draw (Int32 windowWidth, .tk2dSpriteAnimationClip clip, System.Collections.Generic.List`1 frameGroups, Single clipTimeMarker) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:158)
tk2dEditor.SpriteAnimationEditor.ClipEditor.Draw (Int32 windowWidth) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipEditor.cs:564)
tk2dSpriteAnimationEditorPopup.OnGUI () (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationEditorPopup.cs:480)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
« Last Edit: March 30, 2013, 08:27:34 pm by Martin »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: SpriteAnimation crash if images missing from a Sprite collection
« Reply #1 on: March 30, 2013, 08:47:57 pm »
Another way to do this is to switch the inspector to debug mode and fix up the broken references. I'll make a note of this to add some method of recovery though.