GUI doesnt contain a definition for Button??

I am entering the code below and it gives me an error saying GUI doesnt contain a definition for button. here is my code

using UnityEngine;
using System.Collections;

public class GUI : MonoBehaviour {

float buttonX;
float buttonY;
float buttonWidth;
float buttonHeight;

// Use this for initialization
void Start () {
	buttonX = Screen.width * 0.05f;
	buttonY = Screen.width * 0.05f;
	buttonWidth = Screen.width * 0.1f;
	buttonHeight = Screen.width * 0.1f;
}

//Draw GUI
void MyGUI() {
	GUI.Button (new Rect(buttonX, buttonY, buttonWidth, buttonHeight), "Start");
}

}

Has to be called OnGUI

Change MyGUI() to OnGUI() and that would solve the problem

for more information about GUI check this link :

good luck with your project!

You called your own class “GUI” so you’re hiding the “UnityEngine.GUI” class and the compiler searches inside your GUI class for a method called Button which doesn’t exists.

You should rename your class (and filename) to something else.

ps: In your comment you just said “you fixed it” but you didn’t accepted an existing answer nor have you provided your own solution to close this question. Please accept an answer or close the question.