x


Override Editor Controls

Hi all, I've been wondering about this for a few days now, and gave up on it after not finding any answers after a fair whack of searching and just used different key controls. Essentially I have a level editor 'editor script' which allows me to grab objects, group grab, move, spawn and locks the object positions to a grid all on a very basic level which has been very useful in saving some time. Now I've been detecting input commands from the user with the Event class, along the lines of:

if( Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.R )

Which works fine, however I would really like to make it so that I can left click to select objects, or place them and press Spacebar to toggle my editor modes.

Unfortunately left click selects a scene object and Spacebar maximises the current windows viewport. What I would to do is override these controls, so that when my custom inspector (which is my level editor script) is active, it does what I define in that script, is there a way to do this?

Unity obviously has this behaviour as if you edit a terrain, your left clicks don't select the terrain or other objects, they paint textures and such. I'm just not sure if it's exposed - would kinda suck for editor scripting if not though surely?

more ▼

asked Aug 23 '10 at 10:05 AM

Digitalos gravatar image

Digitalos
507 4 7 21

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I'm trying to do something very similar by creating an editor script that allows me to do something like Shift + Left Click on the scene to add waypoints but unfortunately this works the first time but then shift left click selects another object which changes the currently selected object. After a lot of searching I gave up as well and just went with a key combination to drop it at the mouse position.

more ▼

answered Sep 20 '12 at 07:44 AM

Wenceslao gravatar image

Wenceslao
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:

x957
x349
x166
x40

asked: Aug 23 '10 at 10:05 AM

Seen: 1184 times

Last Updated: Sep 20 '12 at 07:44 AM