UnityEditor.GenericMenu.Popup C# (CSharp) Method

Popup() private method

private Popup ( Rect position, int selectedIndex ) : void
position UnityEngine.Rect
selectedIndex int
return void
        internal void Popup(Rect position, int selectedIndex)
        {
            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                this.DropDown(position);
            }
            else
            {
                this.DropDown(position);
            }
        }

Usage Example

示例#1
0
        private bool ShowModePopup(Rect popupRect)
        {
            int umbraDataSize = StaticOcclusionCulling.umbraDataSize;

            if (this.m_PreVis != StaticOcclusionCullingVisualization.showPreVisualization)
            {
                SceneView.RepaintAll();
            }
            if (Event.current.type == EventType.Layout)
            {
                this.m_PreVis = StaticOcclusionCullingVisualization.showPreVisualization;
            }
            string[] strArray = new string[2] {
                "Edit", "Visualize"
            };
            int selectedIndex = !this.m_PreVis ? 1 : 0;

            if (EditorGUI.ButtonMouseDown(popupRect, new GUIContent(strArray[selectedIndex]), FocusType.Passive, EditorStyles.popup))
            {
                GenericMenu genericMenu = new GenericMenu();
                genericMenu.AddItem(new GUIContent(strArray[0]), selectedIndex == 0, new GenericMenu.MenuFunction(this.SetShowVolumePreVis));
                if (umbraDataSize > 0)
                {
                    genericMenu.AddItem(new GUIContent(strArray[1]), selectedIndex == 1, new GenericMenu.MenuFunction(this.SetShowVolumeCulling));
                }
                else
                {
                    genericMenu.AddDisabledItem(new GUIContent(strArray[1]));
                }
                genericMenu.Popup(popupRect, selectedIndex);
            }
            return(this.m_PreVis);
        }
All Usage Examples Of UnityEditor.GenericMenu::Popup