Tag Archives: progress bar

Unity3D: Progressbar using new UI system

Before Unity 4.6 new UI system came out, to create a progress bar, the typical process involve writing the OnGUI() function as follows:

public Texture2D emptyProgressBar; // Set this in inspector.
public Texture2D fullProgressBar;  // Set this in inspector.

void OnGUI() 
    GUI.DrawTexture(Rect(0, 0, 100, 50), emptyProgressBar);
    GUI.DrawTexture(Rect(0, 0, progress, 50), fullProgressBar); = TextAnchor.MiddleCenter;
    GUI.Label(Rect(0, 0, 100, 50), string.Format("{0:N0}%", 
progress * 100f)); }


This is OK, however not recommended in the new GUI system in Unity 4.6+: you don’t want to mix the GUI with the new and legacy system, right?

Here is the process to create a progress bar using the new UI system:

Read the rest of this entry »


Posted by on August 6, 2015 in Programming, Unity 3d


Tags: , , , , , , , , , ,

Android: Change ProgressBar height

In Android development, you might dislike the very thin progress bar that Android defaults. For instance, in the below xml file, though you can specify the width and height, but you can see that width value functions, but the height value, no matter how large you specify, it remains slim horizontal bar:




To get the height value right, it is very simple:

change style=”?android:attr/progressBarStyleHorizontal” to

That is it! Happy coding!


Posted by on August 19, 2014 in Android, Java, Programming


Tags: , , , , , , , ,