i dont know why but my monodevop says that the class GUI doesnt have a Button in it … WTF … And The Documentation Says it’s the only place you get a button in unity
The code you posted is okay.
Did you include:
using UnityEngine; using System.Collections;
in your script ?
A shot in the dark but considering your error message it’s the most obvious:
You named one of your own classes “GUI” which now “replaces” the GUI class in the UnityEngine namespace.
It of course doesn’t replace it literally, but your own classes are in the global namespace and this is always used first when the compiler tries to resolve the class. Even if you have a custom class called GUI you can still use the GUI class from the UnityEngine namespace by using the full name:
However that’s not very nice so the best fix in this situation is to rename your own class-
If that’s not the case, please post the exact error message (you can copy it from the console) and / or post your script that causes the problem.