[Unity]Try to create a circle gauge that advances when the mouse is clicked.
Sometimes when playing games, you may see a UI with a circle-shaped gauge that decreases or increases.
First, prepare a png image of a circle with a transparent background.

The image should be placed on unity.

Next, place the Image in the canvas, this time named “Circle”.

Set the SourceImage of Cricle’s Image component to the prepared png image, Image Type to Filled, Fill Method to Radial360, and Fill Origin to Top, respectively.

In this case, we created a script in Circle and described it as follows
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Circle : MonoBehaviour {
// Use this for initialization
void Start () {
this.GetComponent<Image>().fillAmount = 0;
}
// Update is called once per frame
void Update () {
if(Input.GetMouseButton (0)){
this.GetComponent<Image>().fillAmount += 0.01f;
if( this.GetComponent<Image>().fillAmount >= 1.0f ) {
this.GetComponent<Image>().fillAmount = 0;
}
}
}
}
The circle gauge advances as long as the left mouse button is clicked, and stops when the mouse is released.
Since this is a sample code, the circle gauge is set to return to 0 when it is full.
Please take a look at the sample code if you like. m



![[Unity] Removing grass grown on Terrain from scripts](https://kuroko-labo.com/wp/wp-content/uploads/2025/05/grass2.png)
![[Unity] Executing a method at an arbitrary time with Photon’s PUN2](https://kuroko-labo.com/wp/wp-content/themes/kuroko3/images/noimage.png)
![[Unity]I made a field with Gaia Pro 2023.](https://kuroko-labo.com/wp/wp-content/uploads/2025/01/image06.png)
![[Unity]I bought an OLD TV Filter.](https://kuroko-labo.com/wp/wp-content/uploads/2019/11/image05.png)
![[Unity]Use localPosition to create a conveyor belt-like](https://kuroko-labo.com/wp/wp-content/uploads/2019/06/image01-1.png)
![[Unity]Obtain and display mouse coordinates](https://kuroko-labo.com/wp/wp-content/uploads/2019/03/image02.png)