Hello Guest

Author Topic: Sprite Animation Number of frames  (Read 7339 times)

VGT

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 17
    • View Profile
Sprite Animation Number of frames
« on: April 18, 2012, 12:37:56 am »
Some of the animations I'm creating require me to make multiple sprite collections currently.  (The amount of images and their sizes causes unity to crash while creating the atlases.  Eventually these images will be smaller and it may eliminate this problem)

For the time being I'm using four sprite collections for a single animation. 

Here is what I do to assemble this animation in a Sprite Animation prefab:

1. Select the first collection and press AutoFill.  This fills the animation with the 54 frames that are in the first collection.

2. Click the drop down for Num Frames and increase the number by one.

3. Change the collection for the 55th frame to the next collection and make sure it's on the first image of that sequence.

4. Click AutoFill.

5. If not done, go back to step 2.

The problem that I'm having is that at step 2, if the number of frames is over 99, I cannot add a frame because the dropdown menu doesn't extend that far.  Is there a way to manually enter this value or to go over 99 frames?



My current fix to this problem is I select the last frame and change the collection to the next one (cutting out the last frame of the previous collection).  I then click autofill and I swap that frame that I changed to what it was originally and proceed to change the frame of each one after that to be in proper order. (See Attachment for visual explanation)



I'm hoping that eventually we can fit our animations into one collection without crashing unity during the 'commit'.  If we cannot, there will always be that tedious work of creating the animation.  Could there be a way around this?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Animation Number of frames
« Reply #1 on: April 18, 2012, 01:04:00 am »
Some of the animations I'm creating require me to make multiple sprite collections currently.  (The amount of images and their sizes causes unity to crash while creating the atlases.  Eventually these images will be smaller and it may eliminate this problem)

For the time being I'm using four sprite collections for a single animation. 

Here is what I do to assemble this animation in a Sprite Animation prefab:

1. Select the first collection and press AutoFill.  This fills the animation with the 54 frames that are in the first collection.

2. Click the drop down for Num Frames and increase the number by one.

3. Change the collection for the 55th frame to the next collection and make sure it's on the first image of that sequence.

4. Click AutoFill.

5. If not done, go back to step 2.

The problem that I'm having is that at step 2, if the number of frames is over 99, I cannot add a frame because the dropdown menu doesn't extend that far.  Is there a way to manually enter this value or to go over 99 frames?



My current fix to this problem is I select the last frame and change the collection to the next one (cutting out the last frame of the previous collection).  I then click autofill and I swap that frame that I changed to what it was originally and proceed to change the frame of each one after that to be in proper order. (See Attachment for visual explanation)



I'm hoping that eventually we can fit our animations into one collection without crashing unity during the 'commit'.  If we cannot, there will always be that tedious work of creating the animation.  Could there be a way around this?

With regards to crashing during building the collections, it's probably running out of memory. Most of my tests were done in 64 bit windows, where it can easily cope with multiple 4096x4096 atlases being generated. This number is much much lower in 32 bit windows, due to the process address space begin much lower. The solution then is to split up the source images into more sprite collections.

Perhaps the solution here could be some code to automatically generate your sprite animations in code rather than relying on auto fill? What I'm suggesting is something like this, you give the script a list of sprite collections to work with, and then it generates an animation object out of this with the given name parameters, all done from one script.

Let me know if this is of interest to you.

Also, I need to know what version of 2d toolkit you're running...

VGT

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Sprite Animation Number of frames
« Reply #2 on: April 18, 2012, 07:46:00 pm »
My version of 2D Toolkit is 1.6 final + patch 1.  I have unity version 3.5.1f2 and I'm running on Windows 7 64 bit.

I am creating these animations with sprite thumbnails turned off.  I am currently making these atlases with a max texture size of 4096 x 4096. 

A script to create the animations might be a good fix for now, but we plan on having artists assemble these animations within unity though. Any scripting work on their end wouldn't be possible.

I am still interested in looking into such a script though. Thank you for the response!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Animation Number of frames
« Reply #3 on: April 18, 2012, 09:42:04 pm »
Firstly I suggest keeping the size of sprite collections as small as possible, 2048 is probably a really good number to be aiming for. The memory management for internal assets in Unity is tricky at best - in most cases it's almost impossible to explicitly unload an asset after its been loaded in and used at least once.

I have had no problems building 3-4 different 4096 atlases, one after another. Then again though most of these tests we're performed in isolation after a fresh startup. Things could be different when working on a large project at the same time.

With regards to the problem with the number of sprites, I'll sort this out for you ASAP. There isnt really any point in half solutions and workarounds especially when collaborating with others. Could you drop me an email (support at unikronsoftware dot com) and I'll send you an updated script when ready to see if it solves your problem.

I can't seem to find the forum post with the code snippet too, I'll send that your way in the email as well.

Cheers,
Unikron