menu | 要向其中添加菜单项的场景视图上下文菜单。 |
向场景视图上下文菜单添加菜单项。
请参阅 MenuUtility,了解用于向场景视图上下文菜单添加菜单项的实用程序函数。
public override void PopulateMenu(DropdownMenu menu) { // Add all clipboard operations to the context menu (Cut, Copy, Paste, Delete, and Duplicate). ContextMenuUtility.AddClipboardEntriesTo(menu); // Add an item to the context menu using a delegate or an EditorAction. menu.AppendAction("Parent Item/Child Item", (item) => Debug.Log("Executed Child Item.")); // Add an item to the context menu using a predefined MenuItem. ContextMenuUtility.AddMenuItem(menu, "GameObject/Move To View"); }