GUI Progress Bar

Hello, I have searched for the answer to this question for an hour now and have found NOTHING of use, on multiple websites. All I need is the code that will draw a progress bar on the screen through

OnGUI ()


Update ()

I don’t need anything more, just a bar that will load over a set amount of time and that I can move on the screen. C# is preferable, and the only reason I ask is because I am not the best at GUI elements.

var barDisplay : float = 0;
var pos : Vector2 = new Vector2(Screen.width * 5.05, Screen.height * 0.35);//place in begin group if you want or enter values directly
var size : Vector2 = new Vector2(Screen.width * 0.29,Screen.height * 0.95); //place in begin group if you want or enter values directly
var progressBarEmpty : Texture2D;
var progressBarFull : Texture2D;
var scalemax : float = 1000;
var rotAngle : float = 180;
var pivotPoint : Vector2;

function OnGUI()
pivotPoint = Vector2(Screen.width/2,Screen.height/2);
		GUIUtility.RotateAroundPivot (rotAngle, pivotPoint);
    GUI.BeginGroup (new Rect (Screen.width * 0.925, Screen.height * 0.21, Screen.width * 0.06, Screen.height * 0.64));
        GUI.DrawTexture (Rect (0,0, Screen.width * 0.06, Screen.height * 0.64),progressBarEmpty);
        GUI.BeginGroup (new Rect (0, 0, Screen.width * 0.06, Screen.height * 0.64 * barDisplay));
            GUI.DrawTexture (Rect (0,0, Screen.width * 0.06, Screen.height * 0.64),progressBarFull);
        GUI.EndGroup ();
    GUI.EndGroup ();
function Update()
    barDisplay = (whatever you want to load as progress, scores, time etc... place here)/scalemax;

Try this. Play around with it…rotate it to be horizontal or vertical according to your wishes. I use screen size to determine size so that it would remain consistent across different platforms.
If this works always remember to mark as the answer with the tick so that it can also help others. :slight_smile:

If you don’t have any plans to ship soon you can use the 4.6 beta and a slider.