Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to call EditorApplication.ExecuteMenuItem of a context menu item?

Discussion in 'Scripting' started by Desprez, May 18, 2022.

  1. Desprez

    Desprez

    Joined:
    Aug 31, 2012
    Posts:
    305
    I understand to use EditorApplication.ExecuteMenuItem to call a unity menu item in script.

    How do I use this to call a context menu item when you right click a game object?

    Specifically, I'd like to make a custom editor button to call Unpack, the one you get when you right click a prefab. Prefab > Unpack
     
  2. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Desprez and Bunny83 like this.
  3. Desprez

    Desprez

    Joined:
    Aug 31, 2012
    Posts:
    305
    Perfect