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

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

this feels like a bit of a xy problem chances are you likly just want something from the PrefabUtility
maybe PrefabUtility.UnpackPrefabInstance ?

2 Likes

Perfect