x


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)

more ▼

asked Dec 12 '10 at 02:37 PM

Noam gravatar image

Noam
282 24 24 33

Did you ever find a way around this Noam? I have the same issue.

May 06 '11 at 01:08 AM DoubleDouble
(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

try this link It works for my editor extension

more ▼

answered Jun 02 '12 at 10:29 AM

paradajZ gravatar image

paradajZ
0 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1677
x349
x130

asked: Dec 12 '10 at 02:37 PM

Seen: 1237 times

Last Updated: Jun 02 '12 at 10:29 AM