Using a GUI event : preventing selecting other objects

I created a CustomEditor that listens for mouse clicks in its OnSceneGui to do stuff. These clicks place objects on the terrain (and on other objects) I would like to be able to place several objects with several consecutive mouse clicks.

As soon as the mouse is clicked on an object in the world, the new object is created and placed according to the mouse ray. The problem is this : The clicked object gets immediately selected afterward, so my custom editor is no longer 'active' so I don't get any more events, so I can't place more objects.

I tried two things : 1) Use the event (with event.current.Use() ) 2) Change the selection after creating the new object. (Selection.activeGameObject = ..)

Even when I do both, the object that I clicked on is still the active object after the creation.

Is there any way to get around this?

(Using latest version of Unity Pro)

try this 1
It works for my editor extension