function OnGUI(){
var maxWidth:int=50;
var blackTexture:Texture2D = new Texture2D(1,1);
blackTexture.SetPixel(0,0,Color.green);
blackTexture.Apply();
GUI.DrawTexture(new Rect(50,20,power*2,20), blackTexture);
}
function OnGUI(){
var maxWidth:int=50;
var blackTexture:Texture2D = new Texture2D(1,1);
blackTexture.SetPixel(0,0,Color.green);
blackTexture.Apply();
GUI.DrawTexture(new Rect(50,20,power*2,20), blackTexture);
}
I have a question like this
as for you question on the bar red/green adjust thing, in stead of making a 2,1 texture you could make it a 10,1. as you bar depletes or whatever , more red pixels appear instead of green.
function OnGUI(){
var maxWidth:int=50;
var blackTexture:Texture2D = new Texture2D(2,1);
blackTexture.SetPixel(0,0,Color.green);
blackTexture.SetPixel(1,0,Color.red);
blackTexture.Apply();
GUI.DrawTexture(new Rect(50,20,power*2,20), blackTexture);
}
I have another question how to make it green at the starting point that is 0, when you hit full power it goes to red that mean max
– silvertenchu
how to make it gradient, this is my code with green on the power bar but I want to make it gradient like green and red,how will I do that?
– silvertenchu