Problem with GUI.Button and other GUI items

As long as i test my code in the editor everything is great, but when i build the exe file and run it the Buttons dont disappear like in the editor. The functionality is still the same.

var site:int = 0;
function OnGUI(){
        if(GUI.Button(Rect(0,0,120,30),"Button 1")){
            site = 1;
    else if(site==1){
        if(GUI.Button(Rect(0,40,120,30),"Button 2")){
            site = 2;

In the editor:

There is “Button 1”. After clicking on it “Button 1” disappears and “Button 2” appears. After clicking on “Button 2” this button disapears and there is no button anymore.

In the .exe:

There is “Button 1”. After clicking on it “Button 2” appears and you can also see “Button 1” (without any functionality). After clicking on “Button 2” you can still see both buttons.

There is the same problem with other items like GUI.TextField, GUI.TextArea and GUI.Label.

I hope someone can help me with my little problem.

in the example for the button you have to change: site = 2; to: site = 0;