- Home /
Custom help for editor scripts?
I was wondering if there is a way to customize the help URL for the little book icon in the inspector? Presently I'm using my own help button, but thought it would tidy things up to use the existing UI. Is this possible?
Answer by Bunny83 · Sep 27, 2011 at 01:37 AM
It seems that it's not possible. The function InspectorTitlebar that is used to display the title bar of an inspector uses this code to display the help icon:
if (Help.HasHelpForObject(targetObj))
{
Rect position4 = rect2;
position4.x -= 18f;
if (GUI.Button(position4, EditorGUI.s_HelpIcon, inspectorTitlebarText))
{
Help.ShowHelpForObject(targetObj);
}
position2.xMax = position4.xMin - 2f;
}
The functions Help.HasHelpForObject and Help.ShowHelpForObject are mapped to native code so it seems to be "hard-coded".
I agree that it would be a nice feature to display a custom help page or even better to have a callback for this button ;)
Ok, thanks for the help. I've found that I can either create my own button and/or use @$$anonymous$$enuItem to insert a help item in the drop down menu.
This is really a shame. $$anonymous$$aybe the Unity guys can keep this in $$anonymous$$d for future releases.
Feel free to post a feature request ;)
But think about your words carefully. You have to convince others so they vote for your idea.
I agree, this would allow extension developers to integrate their documentation in the way that Unity users have become accustomed to.
$$anonymous$$ight make sense to add another parameter to the CustomEditorAttribute indicating the documentation URL. In the meantime, you could probably put your own button on top of the standard one, as I suggested in an answer to this question -- http://answers.unity3d.com/questions/373334/how-can-i-link-to-my-doc-in-a-customer-inspector-p.html
Answer by marcojacovone · Feb 06, 2016 at 02:28 PM
Use HelpURLAttribute.
[HelpURL("http://example.com/docs/MyComponent.html")]
public class MyComponent
{
}
http://docs.unity3d.com/ScriptReference/HelpURLAttribute.html
Answer by dgoemans · Mar 06, 2012 at 09:03 PM
Seems like this isn't possible, but for now my solution is putting this in my MonoBehaviour:
[MenuItem("CONTEXT/Tile/Help")]
static void Help ()
{
Application.OpenURL ("http://myhelppage.com");
}
This adds a Help entry to the Context menu for the current script. When you either right click on Script title bar or click on the little drop down menu in next to the help book, this menu comes up.
Hi, this context help is now working differently: http://docs.unity3d.com/Documentation/ScriptReference/Context$$anonymous$$enu.html
No, it doesn't work differently now. Context$$anonymous$$enu is a new attribute that can be used directly in runtime classes, so you can add a context menu item directly to the $$anonymous$$onoBehaviour itself.
The $$anonymous$$enuItem attribute is still valid, but it works differently. The function that should be called have to be static and have to be defined in any editor class.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Section of Unity Docs is Offline! 2 Answers
UnityEngine.Input.GetMouseButton(1)) issue 1 Answer
Editor. Ignore selection some gameObjects 1 Answer
Move Editor Button 1 Answer