How to clip sprites?

Trying to do a powerbar … how can I clip a sprite to size so it only renders part of it at a time?

For example you could use new Rect(100,100,10,power) when using gui to clip it accoring to the value of ‘power’.

Thanks

This doesn’t seem to be possible in the current version of Unity2D - I ended up slightly redesigning the life bars in my game after this discovery :frowning:

Consider: waiting for Unity to support it (if they ever do), switch to NGUI or tk2d (which both support it, I believe), redesigning your GUI, or replacing the 2 health bar sprites with a sprite animation.

You could just use a quad and adjust the texture position.

Or you could just clip it via a Rect from the source. This works well, but not very performant if you updating it a lot.