Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Digitalos · Aug 23, 2010 at 10:05 AM · inputeditor-scriptingeventoverride

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?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image greenshadow · Jul 29, 2013 at 01:31 AM 0
Share

Anyone ever find a solution to achieve this functionality? I am interested in doing the same. For example, when a user presses delete while my level editor is being used, I do not want the default behavior of the Unity editor to be used.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Wenceslao · Sep 20, 2012 at 07:44 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

[Editor] Get Scroll Wheel while dragging 0 Answers

TextField, Event.current, Input.GetKey, and GUI.FocusControl locking 1 Answer

Unity UI 4.6 - Programmatically adding events - EventTrigger.delegates is null 0 Answers

Editor Scripting - Override Scaling 1 Answer

Detect when project is saved 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges