There are two main components:
GoSprite contains all frames and animations.
GoSpritePlayer plays GoSprites.
Hot GoSprite swap:
GoSprite - scriptable object that contains all the sequences and frames
Sequences are named lists of frames
- Creating sequence
- Removing sequence
- Adding frames
Just drag and drop sprites to green “plus” button to add frames to the sequence.
You can select multiple sprites at once by holding Shift or Ctrl key.
Do not forget about handy window lock button.
Now you can shuffle frames
- Swap frames: drag and drop one frame on another
- Move frame: drag and drop frame on green space between frames
- Delete frame: drag and drop frame on red “bin” button
Default play type - automation mode in which the sequence will be played by default
- Default - none, no automation
- Manual - only manual, no automation
- Loop - animation plays till the last frame then reset index to start value, endless
- One shot - animation plays till the last frame then stops
- Ping-Pong - animation plays till the last frame then reverses, endless
You can setup custom event for every frame in a sequence, even multiple evets for one frame. Every time GoSpritePlayer reaches frame with frame event, it invokes FrameEvent event with name of the event as a parameter. 😄
GoSpritePlayer - component that plays GoSprites, i.e. does all the animation housework and sets the necessary sprite to sprite renderer.
- Go Sprite - currently playing GoSprite
- Speed - relative speed value
- Frame delay - frame delay in milliseconds,
frame delay = 200, speed = 2x,
frames per second = 1000 / 200 * 2 = 10
- Sequence Name - current sequence name. If current GoSprite doesn’t contain sequence with such name, property ignored and previous sequence remains.
- Index - current index value. If current sequence doesn’t contain such index, value will be cropped to min/max index.
- PlayType - Sets play type on the player level.
If value sets as “Default”, player uses default play type of current sequence.
Any value other than “default” overrides any default play type of current sequence.
For example, if you wish to manually set index of sequence with “Loop” default play type, you can set player play time as “Manual” it cancels all the automation.
- Index changed - invoked once on update event if index was changed
- Sequence changed - invoked once on update event if sequence name was changed
- GoSpriteChanged - invoked once on update event if GoSprite was changed
- AnimationEnd - invoked at the end of last frame in sequence.
play type when invoked
- loop every time before index reset
- one shot ones, at the last index in sequence after frame delay expired
- ping-pong every time index reached border value, i.e. at 0/max index after frame delay expired
- manual every time index reached border value, i.e. at 0/max index after frame delay expired
- FrameEvent(string eventName) - custom events.
Invoked when index changed and current frame contains event.
GoMecanimAdapter - component that have two purposes
GoMecanimAdapter allows you to forward some GoSpritePlayer events and properties to mecanim. For example when IndexChanged event of GoSpritePlayer fires animator trigger with name “IndexChanged” will be triggered and animator parameter with name “Index” will be changed. Of course you can change names to trigger custom triggers/ set appropriate parameters.
Auto sequence mode
Also this component allows you automatically set sequence depending on current animator state.
For example, with such setup, every time when mecanim animator enters the “walk” state, sequence with name “walk” will be set as GoSpritePlayer current sequence.
GoMecanimAnimator - component that allows you to animate properties of GoSpritePlayer.
It works like proxy representing GoSpritePlayer values as floats that are animatable with mecanim. Respective checkboxes enable animation of property i.e. mapping float values back to GoSpritePlayer.
Since float values should represent discrete properties such as sequence name, don’t forget to set such key values as constants:
GoSpritePlayer animated inside mecanim: