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 () {
print("Pillar Selected");
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.


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