SuperSprite

Overview
The purpose of SuperSprite is to allow you to easily manage playing sprite animations for characters or other entities which must span multiple atlases.  For batching and performance reasons, individual sprites may only be associated with a single atlas/material.  Until recently, this meant that you had to manually hide one sprite as you played an animation on another, and then when that animation ended, hide that sprite and switch over to the other, etc.  SuperSprite now automates this process and manages all the details for you, so that playing animations across multiple sprites at runtime is no more difficult or complicated than playing them on a single sprite.
How it works: SuperSprite manages multiple sprites and their animations for you so that you can define your animations across multiple sprites (even splitting a single animation across multiple sprites), and then play them at runtime as though they were on a single sprite (i.e. supSprite.PlayAnim("Walk")).  At runtime, you needn't worry about how many or which sprites contain the necessary animations to make your character animate seamlessly.
How to use SuperSprite
  1. First, setup your sprites. You can assign certain animations to one sprite, and other animations to another, and you can even split a single animation up among one or more sprites if need be. For example, if it all won't fit onto a single atlas, you could put frames 1-10 of your "Jump" animation on, we will call it "Sprite A", and frames 11-20 on Sprite B.

  2. Drag the SuperSprite component onto a GameObject.

  3. Expand the "Animations" array and enter the number of animations your character/entity has.  For example: If your character has a "Run", a "Jump" and an "Attack" animation, enter "3" here, even if each of these three are spread out over multiple sprites.

  4. Each "Element X" that appears represents an animation for your character/entity.  Expand one of them and enter the animation's name.  For example: If you wish the animation at index 0 to be the "Run" animation, expand "Element 0" and enter "Run" in the Name field.

  5. Expand the "Sprite Anims" array and enter the number of sprite animations that comprise the desired animation.  For example: If your "Jump" animation did not fit onto a single atlas and you had to put the first part of it in an animation on one sprite, and the remainder of it in an animation on another sprite, enter "2" here.

  6. Each "Element X" that appears here allows you to specify, in order, which sprite animations comprise the desired animation.  Drag the appropriate sprite onto the "Sprite" slot, and then fill in the name of the animation on that sprite which represents part of the desired animation.  For example: If the first half of your "Jump" animation is in a sprite animation named "Jump part 1" on Sprite A, and the second half is in an animation named "Jump part 2" on Sprite B, drag Sprite A onto the "Sprite" slot of Element 0, enter "Jump part 1" in the "Anim Name" field, and then drag Sprite B onto the "Sprite" slot in Element 1 and enter "Jump part 2" in its "Anim Name" field.  This tells the SuperSprite that your "Jump" animation is composed of two animations, one called "Jump part 1" in Sprite A, and another called "Jump part 2" in Sprite B, and they should be played in that order.

  7. Set any additional settings:
    *  Loop Cycles works just as it does on an individual sprite: -1 loops infinitely, 1 plays the animation one additional time, etc.
    *  Ping Pong works just like "Loop Reverse" on a sprite and tells it whether to reverse the play direction once the end is reached.

The SuperSprite class has a couple of additional settings itself:
  • Play Default Anim On Start - This setting will play the default animation when the scene is started (see Default Anim below)
  • Default Anim - This is the index of the animation that is to be considered the "default".  This number corresponds to the "Element X" in the "Animations" list.  For example, if you want the animation specified in "Element 0" to be the default, set Default Anim to 0.