- Home /
Too subjective and argumentative
Modal Functionality in Custom Editor Window
I am creating a Tile Map Editor plugin as a learning exercise in understanding Unity's custom editor API.
I have read the manual pages and have made a custom Editor Window appear in the "Windows" toolbar.
I want to have certain keyboard inputs and mouse clicks take on a TileMap-specific meaning in the Scene view when a user highlights the TileMap window. I am unsure how to achieve this.
My first idea was to use the OnFocus() and OnLoseFocus() signals for the custom Editor Window. However, this isn't exactly what I want. Just because the user has clicked on the hierarchy or project windows momentarily doesn't mean that I want the TileMap functionality or gizmos to go away.
The built in "Navigation" window is an example of the behaviour I want. When the user clicks the navigation tab, the currently baked Navmesh shows in blue over the objects in the scene view. Clicking another window like the Hierarchy, Project, or Animation does not get rid of the Navmesh overlay. The overly will only disappear when the user switches back to the Inspector window
Is this possible through the Unity's Editor Extending APIs? Alternatively, am I approaching this plugin design in the correct way to begin with?
This type of question would be much better suited on the forums.