Custom scene view in editor window

I need to draw scene from the camera I want in an editor window. I found this reference. But it does not work. I need the exact functionality as in the link. Anyone got any leads?

Also I want to get mouse events in the window. Any help is appreciated.

You don’t need RenderTextures (which are a pro feature) to render a camera to an editor window. Take a look at this:

public Camera m_Cam;
private Rect sceneRect;

void OnGUI()
{
    //...
    // get a rectangle somehow
    GUILayout.Box("");
    Rect R = GUILayoutUtility.GetLastRect();

    // important: only render during the repaint event
    if (Event.current.type == EventType.Repaint)
    {
        sceneRect = GUILayoutUtility.GetLastRect();
        sceneRect.y += 20; // adjust the windows header

        m_Cam.pixelRect = sceneRect;
        m_Cam.Render(); // render the camera into the window
    }

    /*
    Handles.SetCamera(m_Cam);
    // Here you might want to display some Handles
    */
}

You may also consider making a custom SceneView window, which is really simple, you just derive your window from SceneView instead of EditorWindow, then you can add a custom inspector and check for the specific window being focused to only work in your window, and with Handles, you can basically draw a custom GUI window in sceneview.