Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by Bubsavvy · Sep 18, 2017 at 01:46 AM · editoreditorwindow

Unity Editor Event System

So I am trying to look into playing around with the UnityEditor API to see about starting to develop plugins for my team, but have run into the issue where the Event.current is not doing the expected commandNames. Does any one else have this issue? Is there another way of hooking into the Editor Window to capture copy, deletes, moves etc. in the hierarchy. I have already looked at the docs and have called Event.current in OnInspectorGUI with no luck.

EventAPI

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Sep 18, 2017 at 04:04 AM

No, there's no other way. What exact problem do you have? Keep in mind that certain events could already been processed / used by some built-in mechanics. The "type" of an event will turn into "Ignore" once the even has been used. However the Event class also has the undocumented "rawType" property which should keep it's value even when processed.

Also you just said "EditorWindow". Keep in mind that the Unity editor has several seperate editor windows. The Sceneview, gameview, inspector, console, animationeditor, profiler, ... Those are all editor windows. Events are only set to the active editor window. If you want to get events while the sceneview is active you have to use the scene view gui callback. You have to subscribe a method to this delegate: SceneView.onSceneGUIDelegate. The method you would subscribe would look like this:

 void OnSceneViewGUI(SceneView view)
 {
 
 }
 //
 SceneView.onSceneGUIDelegate += OnSceneViewGUI;

Don't forget to unsubscribe when done. Usually you would use OnEnable to subscribe and OnDisable to unsubscribe.

If you need some general help with the IMGUI you may want to have a look at my IMGUI crash course ^^.

Comment
Add comment · Show 2 · 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
avatar image Bubsavvy · Sep 19, 2017 at 12:35 AM 0
Share

Very informative answer. I am actually looking into doing something similar to what is on the asset store the "Cross Scene Reference Plugin". I have gotten as far as saving over the paths of these references in an internal map that is saved to disk upon saving scenes. So everytime a change is made for an object with the type GameObject or $$anonymous$$onobehavior the reference is stored after the objectpicker window is closed. The problem is when ever a gameobject is moved in the hierarchy the reference is not adjusted to the now new path in the hierarchy. So I am looking to capture that.

avatar image Bunny83 Bubsavvy · Sep 19, 2017 at 03:51 AM 1
Share

I'm not sure if i fully understood your problem, but you may want to have a look at the EditorApplication class. It has several callbacks which might come in handy. Such as:

  • hierarchyWindowChanged

  • projectWindowChanged

  • hierarchyWindowItemOnGUI

  • projectWindowItemOnGUI

Also quite useful might be Selection.selectionChanged-

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

92 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Find instance of EditorWindow without creating new one? 2 Answers

close Editor Widnow Bug ? 0 Answers

Dock Game Window In Code? 1 Answer

why I Cant Add Multiple Objects to the "Object Field" in Editor Window? 3 Answers

Custom Editor window close event...? 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