Version: 2017.1
public static void DisplayPopupMenu (Rect position, string menuItemPath, MenuCommand command);

설명

Displays a popup menu.

Menu is shown at position pos, generated from a submenu specified by menuItemPath using a MenuCommand as menu context.

using UnityEditor;
using UnityEngine;
using System.Collections;

// Shows the Assets menu when you right click on the contextRect Rectangle. public class EditorUtilityDisplayPopupMenu : MonoBehaviour { void OnGUI() { Event evt = Event.current; Rect contextRect = new Rect(10, 10, 100, 100); if (evt.type == EventType.ContextClick) { Vector2 mousePos = evt.mousePosition; if (contextRect.Contains(mousePos)) { EditorUtility.DisplayPopupMenu(new Rect(mousePos.x, mousePos.y, 0, 0), "Assets/", null); evt.Use(); } } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961