Select GameObjects OnSceneView without Colliders

I’m using onSceneGUIDelegate to do very specific things on the scene view:

  1. first one will be to instantiate gameObjects with 1 click
  2. Second one is to delete gameObjects with key + click

First one it’s done, easy.

However to achieve the second one I need to know whats under my mouse when I click without the gameObjects having colliders. It’s very important that I can select them without colliders given that not all of them will have them but, they do need to have at-least one renderer of any kind.

Of course I know where my mouse is on world space, that’s no problem.

Any ideas? I might be approaching this from the wrong perspective, if so, let me know which way you would approach it.

If anyone’s interested I figured this a while back, all you need to do is call

void OnSceneGUI(SceneView view)
{
    Event e = Event.current;
    GameObject go = HandleUtility.PickGameObject(e.mousePosition, true);
    // Do what you must with the go selected
    Debug.Log(go);
}

The second parameter will select the prefab root if set to true, here the link to the doc: