UnityEditor.GUIViewDebuggerWindow.GetViewName C# (CSharp) Method

GetViewName() private static method

private static GetViewName ( GUIView view ) : string
view GUIView
return string
        private static string GetViewName(GUIView view)
        {
            EditorWindow editorWindow = GetEditorWindow(view);
            if (editorWindow != null)
            {
                return editorWindow.titleContent.text;
            }
            return view.GetType().Name;
        }

Usage Example

        private void DoWindowPopup()
        {
            string t = "<Please Select>";

            if ((UnityEngine.Object) this.m_Inspected != (UnityEngine.Object)null)
            {
                t = GUIViewDebuggerWindow.GetViewName(this.m_Inspected);
            }
            GUILayout.Label("Inspected Window: ", new GUILayoutOption[1]
            {
                GUILayout.ExpandWidth(false)
            });
            Rect rect = GUILayoutUtility.GetRect(GUIContent.Temp(t), EditorStyles.toolbarDropDown, new GUILayoutOption[1] {
                GUILayout.ExpandWidth(true)
            });

            if (!GUI.Button(rect, GUIContent.Temp(t), EditorStyles.toolbarDropDown))
            {
                return;
            }
            List <GUIView> views = new List <GUIView>();

            GUIViewDebuggerHelper.GetViews(views);
            List <GUIContent> guiContentList = new List <GUIContent>(views.Count + 1);

            guiContentList.Add(new GUIContent("None"));
            int            selected    = 0;
            List <GUIView> guiViewList = new List <GUIView>(views.Count + 1);

            for (int index = 0; index < views.Count; ++index)
            {
                GUIView view = views[index];
                if (this.CanInspectView(view))
                {
                    GUIContent guiContent = new GUIContent(guiContentList.Count.ToString() + ". " + GUIViewDebuggerWindow.GetViewName(view));
                    guiContentList.Add(guiContent);
                    guiViewList.Add(view);
                    if ((UnityEngine.Object)view == (UnityEngine.Object) this.m_Inspected)
                    {
                        selected = guiViewList.Count;
                    }
                }
            }
            EditorUtility.DisplayCustomMenu(rect, guiContentList.ToArray(), selected, new EditorUtility.SelectMenuItemFunction(this.OnWindowSelected), (object)guiViewList);
        }
All Usage Examples Of UnityEditor.GUIViewDebuggerWindow::GetViewName