THIS CONTENT DOWNLOAD SHORTLY

Objective

You can create circular progress bar in unity for your video game. Here is a simple example of how to achieve circular progress bar in unity.

 

In this example we simply use Below steps to create a circular Progress bar. You can make it look like as per following steps:

 

Step 1 Basic Setup

First, Create a Quad in Hierarchy.

In inspector of Quad, use Transparent/ CutOut/ VertexLit or Unlit/ TransparentCutOutshader that can switch between two textures in Material.

Add Appropriate texture (must be alpha cut out texture).

Now add below script to quad in hierarchy.

 

Step 2 Code Sample

Code for circular progress bar:

usingUnityEngine;
usingSystem.Collections;
 
public class CiclularProgress : MonoBehaviour {
 
publicinttimeToComplete = 3;
 
// Use this for initialization
void Start () {
//Use this to Start progress
StartCoroutine(RadialProgress(timeToComplete));
}
 
IEnumeratorRadialProgress(float time)
    {
float rate = 1 / time;
float i = 0;
while (i < 1)
        {
            i += Time.deltaTime * rate;
gameObject.renderer.material.SetFloat("_Cutoff", i);
yield return 0;
        }
    }
}

Note

To use this ProgressBar, set the value of timetoComplete variable as a number of seconds (In the above example we assume that timetoComplete=3) that’s required to complete one entire cycle.

 

Step 3 Output

Circular Progress Bar Output

A Video of above code you can find here:

 

I hope you found this blog helpful while Creating Circular Progress bar in Unity. Let me know if you have any questions or concerns regarding Unity, please put a comment here and we will get back to you ASAP. Got an Idea of Game Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Game Development Company in India.

I'm Dipak Sorathia and I've been working as 3D game developer for over 1 year on Unity3D game engine. Strong at create a great experience in games through cinematography and visual effect.

face mask Belial The Demon Headgear Pocket Staff Magic