- Home /
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)
Did you ever find a way around this Noam? I have the same issue.
Your answer
Follow this Question
Related Questions
Editor. Ignore selection some gameObjects 1 Answer
get folder from selection array 4 Answers
"add selected" editor script 1 Answer
Editor Script Selection thinks Sprites are Texture2Ds. 2 Answers