예제 #1
0
        /// <summary>
        ///  Generate/Build the context menus for this application.
        /// </summary>
        private void InitializeContextMenus()
        {
            GUILayout.BeginHorizontal();

            // File Menu
            if (GUILayout.Button("File", EditorStyles.miniButtonLeft))
            {
                GenericMenu contextMenu = new GenericMenu();

                contextMenu.AddMenuItem("New", NewTemplate);
                contextMenu.AddMenuItem("Open", OpenTemplate);
                contextMenu.AddMenuItem("Save", SaveTemplate);

                contextMenu.ShowAsContext();
            }

            this.AddCustomContextMenus();
            GUILayout.EndHorizontal();
        }
예제 #2
0
    /// <summary>
    ///  Adds context menus specific to this utility.
    /// </summary>
    protected override void AddCustomContextMenus()
    {
        // Edit Menu
        if (GUILayout.Button("Edit", EditorStyles.miniButtonMid))
        {
            GenericMenu editMenu = new GenericMenu();
            editMenu.AddMenuItem("Add Node", AddNode);

            editMenu.ShowAsContext();
        }
    }