GUI Texture problem

Hi guys

I have a gui texture that I use to indicate the thrust left on my plane burners. What script can I use to decrease the width of this texture as the player uses up the fuel?

Thanks

Hello there o/ I used something very similar in my project, it’s very simple: you create a rectangle and a variable that controls the width of that rectangle, than you display it on the screen with GUI.DrawTexture. Here’s my code:

var myRect:Rect;
var myText:Texture;
var fuel:int = 100;

function Start(){ 
	myRect = Rect(300,10,200,50);  
} 
function Update(){
	myRect.width = fuel;
}
function OnGUI(){ 
	GUI.DrawTexture(myRect, myText); 
}