Making a square pie timer

I’m trying to make a translucent overlay for my ability buttons to show the remaining cooldowns on them. I want the overlay to work like circular timer or progress bar, but it needs to be the same shape of the button (square). Here’s an example:

42200-timer-example.png

In the past I have done this in other game engines by drawing an oversized circle with a slice missing from the circle that represents the time expired, then cropping the circle smaller in the shape of a square.

I found an easy way to do the circle timer with this library: Create Circular Progress bar in Unity, but nothing about the best way to do the square-shaped timer.

Does anyone know the best way to do this in Unity?

With the new UI, this is actually really easy.

Make an Image component, be sure to put a sprite in it, and set its Image tpe to Filled, select Radial 360.

You can set an Image´s fillAmount in a script.