Button is not a member of GUI?

alright so i just started making a simple GUI script for my own testing purposes, and for some reason when i run this script:

function OnGUI () {
if(GUI.Button(Rect(10,10,100,50),"Pillar")){
print("Pillar Selected");
}
if(GUI.Button(Rect(10,60,100,50),"Wall")){
print("Wall Selected");
}
}

it refuses to work, i get an error saying: "BCE0019: 'Button' is not a member of 'GUI'." what am i missing?

My best guess is that you have a script named GUI, and your code is trying to find a Button method in this script.

If I am right, just rename your script to something other than GUI and it should work just fine.

-Larry

You may also go to Assets > create >GuiSkin and attactch your script to your GUI skin. Hope this works.