x


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?

more ▼

asked May 01, 2012 at 03:56 AM

numberkruncher gravatar image

numberkruncher
4.3k 140 99 123

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first
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");
    }

}
more ▼

answered May 01, 2012 at 11:29 PM

numberkruncher gravatar image

numberkruncher
4.3k 140 99 123

(comments are locked)
10|3000 characters needed characters left

I would assume it's as easy as

[MenuItem ("Help/Show PDF")]
static void ShowPDF()
{
    System.Diagnostics.Process.Start("yourpdf.pdf");
}
more ▼

answered May 01, 2012 at 04:18 AM

-hiTo- gravatar image

-hiTo-
430 3 5

Thank you for your response. I tried to do this but I could not get this to work properly on Mac. (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).

May 01, 2012 at 11:22 PM numberkruncher
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2642
x51
x30

asked: May 01, 2012 at 03:56 AM

Seen: 781 times

Last Updated: May 01, 2012 at 11:29 PM