Hello Guest

Author Topic: Sprite Animation Clip Length not Updating  (Read 4244 times)

kevrags

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Sprite Animation Clip Length not Updating
« on: May 04, 2013, 11:01:15 pm »
Hello,

Today I created a clip in the wrong Sprite Animation.  So, I deleted the clip and clicked Commit.  However, the length of the clip array didn't revert to the previous value.  I use the length value in some code to change the displayed clip during runtime, and I'm getting Index out of Range errors now.  If I just add a blank clip, the code will run, with the blank clip displaying the first anim clip.

I can delete the Sprite Animation and create a new one, but this would either seem to be a bug, or I'm not regenerating something properly after deleting anims.  I'm using the latest version of the Toolkit.

Thanks for the help,

Kevin

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Animation Clip Length not Updating
« Reply #1 on: May 04, 2013, 11:12:36 pm »
The length may not change to keep the ids consistent.
If you delete something in the middle of the list, it will simply mark it as Empty.

if you want to know how many valid clips there are, run through the list and check for !Empty.

kevrags

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Sprite Animation Clip Length not Updating
« Reply #2 on: May 05, 2013, 01:56:05 am »
I knew there would be a good reason!  The code is an initial randomizer to shuffle the reel strips of the game I'm working on, and is probably a temporary solution, anyway.

Thanks again,

Kevin