- Home /
How to organize sprites
Hello,
I'm making an isometric game and I have a character, which needs to run and perform a few attack animations, in all 8 directions. (up, down, left, right + diagonals). In another question here I have read that on the iOS platform my textures should be 2048 at most, in order to support a bit older devices, like the iPhone 3GS.
So I did a few tests. If my sprite sheet is 2048 and the frame size is 256, I will need at least 4 sheets to fit all my sprites. Which makes me think that I'm supposed to ask first :)
So, what's the common practice around this issue?
Have a few different materials with separate sprite sheets and switch on the fly?
Cut the number of frames in the animation? I'm currently at 24fps and one run cycle is exactly 24.
Cut down the frame size? Down to 128 maybe?
Please advise. Thanks!
Answer by meat5000 · Oct 22, 2013 at 11:20 PM
Texture swapping actually seems to be a very low intensity exercise.
And yes 2048 is max on mobile atm.
Have one material and simple swap in the 'sprite sheet' texture you wish to use. Are you using offset to change frame?
This may not help you here but Erics TSA is a great example of what can be done. It was written as an alternative to video but can actually be used for many things.
For the frame animations, I'm using a script from a tutorial series on walkerboystudio.com, which seems to be working just fine (the 2D mario clone series). So you are saying that it's ok to have 4 or maybe 8 sheets, each 2048 pixels, for the main character?
I just looked at Erics TSA script, it seems like you are feeding it with a separate texture for each frame, rather than using a sprite sheet. No?
I don't see why not.
Try the texture swap animator I linked and try swapping the texture out every frame. If it can handle that without performance drop you will be fine.
I just looked at Erics TSA script, it seems like you are feeding it with a separate texture for each frame, rather than using a sprite sheet. No?
Yep, I linked it for you to see how your game handles swapping a 2048 texture per frame. You can easily modify it too, for other things. Point is, if performance is fine in the worst-case scenario, everything is dandy.
Did you test the script? Could you post results for completeness?
I won't close the QA as I know there are many UA powerusers who will have some good answers on this one.
Not related, but putting this here so you'll see it:
@meat5000, please stop closing questions just because they have an accepted answer. Having an accepted answer doesn't mean that someone couldn't post a better answer later, especially if something in Unity changes and the original answer becomes outdated.
Your answer
Follow this Question
Related Questions
pixel perfect 2d Sprite in 3d world with isometric camera, how to do it right? 1 Answer
New sprites in 2D projects only? Cannot add in 3D project 0 Answers
2D Bring closest spites to front 1 Answer
Unity for 2D (isometric) pixel art game - how to keep the real size of the sprite in-game? 1 Answer
Isometric using 2D sprite 0 Answers