UnityEditor.PopupWindow.Init C# (CSharp) Method

Init() private method

private Init ( Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper locationPriorityOrder ) : void
activatorRect UnityEngine.Rect
windowContent PopupWindowContent
locationPriorityOrder PopupLocationHelper
return void
        private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            this.Init(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu);
        }

Same methods

PopupWindow::Init ( Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper locationPriorityOrder, ShowMode showMode ) : void

Usage Example

Ejemplo n.º 1
0
        // Shown on top of any previous windows
        internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder, ShowMode showMode)
        {
            // If we already have a popup window showing this type of content, then just close
            // the existing one.
            var existingWindows = Resources.FindObjectsOfTypeAll(typeof(PopupWindow));

            if (existingWindows != null && existingWindows.Length > 0)
            {
                var existingPopup = existingWindows[0] as PopupWindow;
                if (existingPopup != null && existingPopup.m_WindowContent != null && windowContent != null)
                {
                    if (existingPopup.m_WindowContent.GetType() == windowContent.GetType())
                    {
                        existingPopup.CloseWindow();
                        return;
                    }
                }
            }

            if (ShouldShowWindow(activatorRect))
            {
                PopupWindow win = CreateInstance <PopupWindow>();
                if (win != null)
                {
                    win.Init(activatorRect, windowContent, locationPriorityOrder, showMode, true);
                }
                if (Event.current != null)
                {
                    EditorGUIUtility.ExitGUI(); // Needed to prevent GUILayout errors on OSX
                }
            }
        }
All Usage Examples Of UnityEditor.PopupWindow::Init