I try to build this script.
But an error occured.
How can I solve this???
var percent: float;
var ProcessBar:Texture2D;
var Title:Texture2D;
var Process:float = 0;
function OnGUI(){
var width;
var height;
width = Title.width;
height = Title.height;
GUI.BeginGroup(new Rect((Screen.width-width)/2,200,width,height));
GUI.DrawTexture(Rect(0,0,width,height),Title);
GUI.EndGroup();
width = ProcessBar.width;
height = ProcessBar.height;
GUI.BeginGroup(new Rect((Screen.width - width )/2,400,width,height));
GUI.DrawTexture(Rect(0,0,width,height),ProcessBar);
Color temp = GUI.color; // ';'expected. Insert a semicolon at the
end. (UCE0001)
GUI.color = Color.white;
if( Process < width )
{
Process ++;
GUI.Box(Rect(Process , 0 , width - Process , height) , "");
}
GUI.color = temp;
GUI.EndGroup();
}
You just have to replace the "Color temp" with "var temp". You can (but you don't have to) append " : Color".
Like this:
var percent: float;
var ProcessBar:Texture2D;
var Title:Texture2D;
var Process:float = 0;
function OnGUI(){
var width;
var height;
width = Title.width;
height = Title.height;
GUI.BeginGroup(new Rect((Screen.width-width)/2,200,width,height));
GUI.DrawTexture(Rect(0,0,width,height),Title);
GUI.EndGroup();
width = ProcessBar.width;
height = ProcessBar.height;
GUI.BeginGroup(new Rect((Screen.width - width )/2,400,width,height));
GUI.DrawTexture(Rect(0,0,width,height),ProcessBar);
var temp : Color = GUI.color; // ';'expected. Insert a semicolon at the end. (UCE0001)
GUI.color = Color.white;
if( Process < width ){
Process ++;
GUI.Box(Rect(Process , 0 , width - Process , height) , "");
}
GUI.color = temp;
GUI.EndGroup();
}
Thank you.
It works very well.