Gui Window Will not display

I need a window for a custom editor for my current project but no matter what I do I can get it to show up or even print out what is in the window function.

I have looked through a lot of similar question but so far they have not helped.
I just want a window to show up, Please Help

My Code:

[CustomEditor(typeof(PrefabManager))]
public class PrefabManagerEditor : Editor
{

private Rect popUpRect = new Rect(50, 50, 120, 50);
private bool buttonClicked = false;

///
/// When the inspector Gui needs to do something
///
public override void OnInspectorGUI()
{
if (GUILayout.Button(“Make PopUp”))
{
buttonClicked = true;
}

if(buttonClicked)
{
  Debug.Log("Clicked");
  buttonClicked = false;
  popUpRect = GUILayout.Window(1, popUpRect, PopUpWindow,"PopUp"); 
}

}

private void PopUpWindow(int winId)
{

Debug.Log("Popup");    // This does not get called??!!

}

}

When using GUI.Window within an EditorWindow you need to surround your code with BeginWindows( ) and EndWindows( ).

It’s very nicely documented when you know which method to look for. Unfortunately there is no mention of this when reading the GUI.Window documentation so it’s pretty easy to miss.

Hopefully you’ve solved your problem in the mean-time anyway.

The script reference explains this really well: EditorGUILayout.Window

Scroll down to the bottom and there is a complete code example.