Nov
30
2018

Sprite Sheet Flip Book Shader

Converted this old animated sprite sheet script into shader,
its useful for animating sprites from sprite sheet. (when Animator is too heavy for simple sprite animation)

Could be extended to have billboard option.

Shader source: *Updated: 30/11/18 to fix index wrapping and UV direction
https://github.com/UnityCommunity/UnityLibrary/blob/master/Assets/Shaders/2D/Sprites/FlipBook.shader

Note:
– Texture should have wrap mode: Repeat *Now works with both wrapping modes (and index 0,0 start from top now)

Resources:
– Used this sprite sheet for the explosion https://opengameart.org/content/explosion-sprite


Some debugging drawings in excel..


2 Comments + Add Comment

  • Thanks for sharing this. As it is, it’ll nicely work for things that repeat constantly. Do you know how you’d go about making it a one-shot animation? You’d need some way of triggering it to start on the correct frame and stop rendering once it hit the last frame.

  • Thanks you !

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Github Join Discord Twitch Instagram BlueSky

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.