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..
Related Posts
2 Comments + Add Comment
Leave a comment
Recent posts
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
- Check if point is inside polygon 2D (using line intersection)
- UnityHub: Enable Create Project Button (without having to select Cloud Organization)
- UI: Make Tooltip background fit Text content length
- Pong-Wars in Unity
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)
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 !