Getting Event.current in the editor all the time

Hi,

I'm trying to create a script that places objects in the scene based on my mouse position. The main function is this :

[MenuItem("GameObject/Place object via raycast _&r")]
public static void PlaceObjectViaRaycast()
{
    if (Selection.activeGameObject && Camera.current)
    {
        Ray camRay = lastRay;
        RaycastHit hitInfo;
        if (Physics.Raycast(camRay, out hitInfo))
        {
            Selection.activeGameObject.transform.position = hitInfo.point;
        }
    }
}

The question is how to I populate lastRay? I started of by deriving from Editor and using this :

public void OnSceneGUI()
{
    lastRay = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
}

However, this forces me to have the editor edit all gameobjects ([CustomEditor(typeof(GameObject)] etc), which is a bad thing IMO (has some side effects). If I do the same call in OnGUI, even if I add the ExecuteInEditMode attribute, I only get the event when I'm in game view, while I want to be in scene view.

Is it possible to write code that will get the Event.current in its context that will be active regardless of the object that is currently selected in the scene, without writing a custom editor for all gameobjects?

I believe that currently the Editor class is the only way to hook into Scene events. What side effects are you seeing from make a CustomEditor for GameObjects? (Other then not being called when no object is selected, that is).

use OnSceneGUI it solves the problem of being in gameview instead of sceneview but the other problem is not solvable till unity exposes more of it's editor functionality