Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

How to detect which tab is focused

Discussion in 'Editor & General Support' started by Dezeris85, Dec 22, 2019.

  1. Dezeris85

    Dezeris85

    Joined:
    Dec 16, 2016
    Posts:
    15
    I was wondering is there a way to detect which of my tabbed windows is currently up front and showing. Like If I have my Inspector window and a custom window tabbed together in the same area and I have the custom window showing and the inspector isn't....is there a way in code to tell?
     
  2. Madgvox

    Madgvox

    Joined:
    Apr 13, 2014
    Posts:
    850
    You can detect if your editor window is open via OnEnable. If you switch to the Inspector tab and your window disappears as a result, it will call OnDisable.

    You can check what the currently focused window is via EditorWindow.focusedWindow.
     
  3. Dezeris85

    Dezeris85

    Joined:
    Dec 16, 2016
    Posts:
    15
    does not work, enable fires but disable never does until you close the tab... not switching to another
     
unityunity