unity3d-class-type-reference icon indicating copy to clipboard operation
unity3d-class-type-reference copied to clipboard

EditorWindow.focusedWindow is null on Ubuntu 16.04

Open Busata opened this issue 7 years ago • 2 comments

Hi,

First of all, thanks for this plugin, was what I was looking for. But when trying it on my ubuntu 16.04 the following line EditorWindow.focusedWindow.SendEvent(typeReferenceUpdatedEvent);, after selecting a type from the drop down, fails with a nullpointer, e.g. focusedWindow. Seems that the window does not have proper focus or unity linux doesn't support it all that well. Perhaps there are other ways to get the event to its destination?

Kind regards,

Dries

Busata avatar Feb 16 '18 13:02 Busata

EditorWindow focusedWindow = null;
            EditorWindow[] allWindows = Resources.FindObjectsOfTypeAll<EditorWindow>();
            for (int i = 0; i < allWindows.Length; i++)
            {
                if (allWindows[i].titleContent.text == "Inspector")
                {
                    focusedWindow = allWindows[i];
                }
            }

I've replaced it with this, pretty dirty hack but makes it work for me until Unity/Ubuntu resolves the focus issue I suppose.

Busata avatar Feb 21 '18 16:02 Busata

Had the same issue with Unity 2018.2.4f1 on Linux. The workaround helped, thx!

master-lincoln avatar Oct 12 '18 14:10 master-lincoln