It looks fine in the preview, but in the game the sprite is cut in half.
#How do I fix the UV of my sprite flipbook shader?
1 messages · Page 1 of 1 (latest)
Partially fixed: Set sprite type to "Single" instead of "Multiple"
Sprite is stretched out, though
I can fix it technically by forcing the width to 16 by using "sliced"
Ok well, I'm not really sure why but when I changed it back to "Simple" draw mode, the aspect ratio was corrected
Whatever
Sprite renderers already do their own flipbooking, and get their shape from sprite meta data
So doing your own while still using the sprite renderer easily conflicts with that
You could instead use a quad mesh (with sorting group component if you want sprite sorting), or a sprite graph with a dummy sprite
Well I don't know how to swap between the sprites if it is built in
Without an animator
I don't want to make an animation for every power up item I have
the way I have it right now works because I just set the X scale to 0.5
and that fixed the stretching
Both my suggestions are for using the flipbook shader as you do now, but to make it work better with sprites
Not sure what you mean by dummy sprite, I do already have a graph set up in this video ^
But alternatively scripts can also be used to swap the sprite of a sprite renderer
Yeah I wanted to avoid that
I'd rather just have one spritesheet as an input and just have it automatically animate
Sprite renderer must take its shape, size and UVs from an existing sprite
But your shader is overriding the sprite and adjusting the UVs
So you need some sprite there that matches the shape of a sprite from the sprite sheet you're animating via flipbook
Ohhhhhhhh
That makes a lot of sense
That would explain why changing the scale to 0.5 worked, since there are only two sprites and they're arranged in a row
But it can't be the sprite sheet itself, because the sheet is much bigger in single mode than one sprite on it
And in multiple mode the sprite renderer is taking only the UV region of one individual sprite so the UV modifications from the flipbook node are no longer valid
Yes, that'll be valid for any 16x16 sprite sheets you have