execute a menu command from script unity code example
Example: execute a menu command from script unity
EditorApplication.ExecuteMenuItem("GameObject/3D Object/Cube");
EditorApplication.ExecuteMenuItem("GameObject/3D Object/Cube");