- Home /
Question by
numberkruncher · May 01, 2012 at 03:56 AM ·
editorextensionmenuitem
Ability to define custom help menu (PDF)
When creating an editor extension is it possible to define a custom menu item under "Help" that displays a PDF asset?
Comment
Best Answer
Answer by numberkruncher · May 01, 2012 at 11:29 PM
public static class MyHelpMenu {
[MenuItem("Help/My User Guide")]
public static void OnHelp_MyUserGuide() {
EditorUtility.OpenWithDefaultApp("Assets/My Asset/Support/User Guide.pdf");
}
[MenuItem("Help/My API Documentation")]
public static void OnHelp_MyAPIDocumentation() {
// Note: Open CHM file on Windows, otherwise use online guide
if (Application.platform == RuntimePlatform.WindowsEditor)
EditorUtility.OpenWithDefaultApp("Assets/My Asset/Support/API Documentation.chm");
else
EditorUtility.OpenWithDefaultApp("http://example.com/product/api");
}
}
Answer by -hiTo- · May 01, 2012 at 04:18 AM
I would assume it's as easy as
[MenuItem ("Help/Show PDF")]
static void ShowPDF()
{
System.Diagnostics.Process.Start("yourpdf.pdf");
}
Thank you for your response. I tried to do this but I could not get this to work properly on $$anonymous$$ac. (Probably something I was doing wrong) But I did accidentally stumble upon the solution (thanks to IntelliSense) when I was writing another piece of code (see below).