SpriteRenderer draw only part of the sprite?

Hey guys, is there any way to draw only part of the texture (cropped) as a sprite with spriterenderer? I could simply make a new texture but I’m looking for code solution as I’m working on hp bars etc.

Any tips are appreciated!

you can do this in 2 ways:

Use a shader

split your texture (make the texture type=>sprite and then sprite mode=>multiple and use sprite editor to split the image) to a lot of pieces and then draw only part of them together