Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

MainToolbar.OpenMainToolbarPicker

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void OpenMainToolbarPicker(string filter);

Parameters

Parameter Description
filter An initial search filter for the picker. Pass an empty string or null for no filter.

Description

Opens the Main Toolbar picker, pre-filtered to a search term.

Equivalent to calling MainToolbar.OpenMainToolbarPicker with PickerMode.All. The Main Toolbar picker stays open after each pick, so you can toggle several elements or menu item shortcuts in a row.


Declaration

public static void OpenMainToolbarPicker(PickerMode mode, string filter);

Parameters

Parameter Description
mode Which tab the picker opens to. Refer to MainToolbar.PickerMode. Defaults to All.
filter An initial search filter for the picker. Pass an empty string or null for no filter.

Description

Opens the Main Toolbar picker. The Main Toolbar picker is a search window you can use to find and toggle toolbar elements and menu items.

The Main Toolbar picker stays open after each pick, so you can toggle several elements or menu item shortcuts in a row. Use MainToolbar.PickerMode to open directly on toolbar elements or menu items only, or leave it at the default to show everything together.

using UnityEditor;
using UnityEditor.Toolbars;

public class MainToolbarPickerExample
{
    // Opens the picker filtered to just this package's own toolbar elements, so users
    // can find and pin them without wading through everything else in the picker.
    [MenuItem("Examples/Open My Package's Toolbar Elements")]
    static void OpenPickerForMyPackage()
    {
        MainToolbar.OpenMainToolbarPicker(MainToolbar.PickerMode.ToolbarElements, "My Package Name");
    }
}