- Home /
How do I tell which GUI window currently has focus?
I know you can focus windows using GUI.FocusWindow(int), but how do you know which window currently has focus?
Answer by Julian-Glenn · Jul 30, 2010 at 03:59 AM
There is no specific "hasFocus" method or function but here is a similar thread and some possible workarounds:
http://forum.unity3d.com/viewtopic.php?p=125931&sid=326d6eea72706e6216e73ca6904c2774
I'm currently trying to solve this problem. Found this using google. And this just re$$anonymous$$ds me how I will never answer any question with a link to another site. because 404!
Answer by MediaGiant · May 26, 2015 at 04:51 PM
For custom editor windows, you can find the active window by the window title
EditorWindow.focusedWindow.title
You can also find if the scene view window has focus by using
if (EditorWindow.focusedWindow == SceneView.currentDrawingSceneView)
Debug.Log ("'ere");
There may be more than one scene view window open so also check this with
SceneView.sceneViews.Count