So here’s the deal, I want to create a button that does something when I push it.
var a = 1;
function OnGUI() {
if(GUI.Button (Rect (0,0,20,20), "Click Here") && (a == 1){
a = 2;
}
}
That works just fine, but I want to add a use for the button if a = 2
var a = 1;
function OnGUI() {
if(GUI.Button (Rect (0,0,20,20), "Click Here") && (a == 1){
a = 2;
}
if(GUI.Button (Rect (0,0,20,20), "Click Here") && (a == 2){
a = 1;
}
}
But this gives me two buttons on top of each other. How can I make the button do multiple different things depending on the second conditional I give it? Do I need to use “else if” in some way? Or am I way off? Any help would be appreciated, I’m sure this is simple and I’m just overlooking something.