How to anchor a GUI . begin group or label to the bottom left instead of top left

My problem could probably be solved with a simple addition of code, but I’m trying to learn gui. What I’m trying to do is make a power bar grow from the bottom, however, OnGUI by default is anchored to the top left so my begin group shrinks from the bottom and I need it to grow up, not down. I’ve searched everywhere and only found answers to a text based gui label and I need a 2d texture based which seems to be a completely different story because of the convenient alignment with text in a guistyle or skin.

#pragma strict

var pBarImage : Texture2D;
var pBarOutline : Texture2D;
var power : float = 10;

function OnGUI () {

	GUI.BeginGroup(Rect(Screen.width * 0, Screen.height * -0.004, Screen.width * 0.208 , Screen.height - power) );
	GUI.Label(Rect(Screen.width * 0, Screen.height * -0.004, Screen.width * 0.208, Screen.height * 0.24), pBarImage );
	GUI.EndGroup();
	
	GUI.Label(Rect(Screen.width * 0, Screen.height * -0.004, Screen.width * 0.208, Screen.height * 0.24), pBarOutline);
	
}

Thanks for future help :slight_smile:

Ok I figured out another way to do it. It doesn’t necessarily get the exact effect I wanted which was masking the top portion and gradually dwindling the mask up, but I got it to hide the bottom of the bar and I was able to move the bar up into full view with this change:

#pragma strict

var pBarImage : Texture2D;
var pBarOutline : Texture2D;
var power : float = 0.22;

function OnGUI () {

	GUI.BeginGroup(Rect(Screen.width * 0, Screen.height * -0.004, Screen.width * 0.208 , Screen.height * 0.23 ));
	GUI.Label(Rect(Screen.width * 0, Screen.height * 0.2 - power, Screen.width * 0.208, Screen.height * 0.24), pBarImage );
	GUI.EndGroup();
	
	GUI.Label(Rect(Screen.width * 0, Screen.height * -0.004, Screen.width * 0.208, Screen.height * 0.24), pBarOutline);
	
}

then I was able to increase the power variable which basically moved the bar up rather than previously where I wanted to just reveal the top of the bar gradually. Not the same effect but I definitely works without getting overly complicated!