UnityEditor.EditorUtility.DisplayCustomMenuWithSeparators C# (CSharp) Method

DisplayCustomMenuWithSeparators() static private method

static private DisplayCustomMenuWithSeparators ( Rect position, string options, bool enabled, bool separator, int selected, SelectMenuItemFunction callback, object userData ) : void
position UnityEngine.Rect
options string
enabled bool
separator bool
selected int
callback SelectMenuItemFunction
userData object
return void
        internal static void DisplayCustomMenuWithSeparators(Rect position, string[] options, bool[] enabled, bool[] separator, int[] selected, SelectMenuItemFunction callback, object userData)
        {
            DisplayCustomMenuWithSeparators(position, options, enabled, separator, selected, callback, userData, false);
        }

Same methods

EditorUtility::DisplayCustomMenuWithSeparators ( Rect position, string options, bool enabled, bool separator, int selected, SelectMenuItemFunction callback, object userData, bool showHotkey ) : void
EditorUtility::DisplayCustomMenuWithSeparators ( Rect position, string options, bool separator, int selected, SelectMenuItemFunction callback, object userData ) : void
EditorUtility::DisplayCustomMenuWithSeparators ( Rect position, string options, bool separator, int selected, SelectMenuItemFunction callback, object userData, bool showHotkey ) : void

Usage Example

            protected override void OnGUIMenu(Rect connectRect, List <ProfilerChoise> profilers)
            {
                if (additionalMenuItems == null)
                {
                    additionalMenuItems = new List <string> {
                        "Player Logging"
                    };
                    if (Unsupported.IsDeveloperMode())
                    {
                        additionalMenuItems.Add("Full Log (Developer Mode Only)");
                    }
                    additionalMenuItems.Add("");
                }

                var names = additionalMenuItems.Concat(profilers.Select(p => p.Name)).ToArray();

                // "Player Logging" field is always enabled.
                var enabled = new List <bool> {
                    true
                };
                var selected = new List <int>();

                var connected = PlayerConnectionLogReceiver.instance.State != PlayerConnectionLogReceiver.ConnectionState.Disconnected;

                if (connected)
                {
                    selected.Add((int)MenuItemIndex.PlayerLogging);
                    if (Unsupported.IsDeveloperMode())
                    {
                        if (PlayerConnectionLogReceiver.instance.State == PlayerConnectionLogReceiver.ConnectionState.FullLog)
                        {
                            selected.Add((int)MenuItemIndex.FullLog);
                        }

                        // Enable "Show Full Log"
                        enabled.Add(true);
                    }
                    enabled.Add(true);
                    enabled.AddRange(profilers.Select(p => p.Enabled));
                }
                else
                {
                    // everything but first menu item is disabled.
                    enabled.AddRange(new bool[names.Length - 1]);
                }

                int index = profilers.FindIndex(p => p.IsSelected());

                if (index != -1)
                {
                    selected.Add(index + additionalMenuItems.Count);
                }

                var seperators = new bool[enabled.Count];

                seperators[additionalMenuItems.Count - 1] = true;
                EditorUtility.DisplayCustomMenuWithSeparators(connectRect, names, enabled.ToArray(), seperators, selected.ToArray(), SelectClick, profilers);
            }
All Usage Examples Of UnityEditor.EditorUtility::DisplayCustomMenuWithSeparators
EditorUtility