Hello, I’m trying to make left and right GUI buttons for my character. But when ever the left button is pressed, the right button disappears. The right button works correctly.
I figure it’s because once the left button conditional statement is started, the if statement that shows the right is no longer activated. Any combination of if/else if statements don’t seem to work.
Here’s my code:
`
var theMainCharacter : GameObject;
function OnGUI () {
if (GUI.RepeatButton(Rect (0,Screen.height - 50,100,50), "Left")) {
theMainCharacter.animation.CrossFade ("walk");
}
else{
if (GUI.RepeatButton(Rect (100,Screen.height-50,100,50), "Right")) {
theMainCharacter.animation.CrossFade ("walk");
}
else{
theMainCharacter.animation.CrossFade ("idle");
}
}
}
`