Anybody know how to get the help of the Unity API in the Visual Studio IDE? Thanks.
I realize this is an old question, but wanted to add some additional information for those that might benefit.
- For those that don’t have it, install Visual Studio. It’s now free for many users.
- Make sure Visual Studio Tools for Unity is installed and the configuration is done.
- As djradon mentioned, the standard shortcut is CTRL+ALT+M,CTRL+H for Unity Documentation Access
If you want a simpler shortcut or even to make it the same as in MonoDevelop, you can do the following…
- Open Visual Studio
- Go to: Debug > Options and Settings > Environment > Keyboard
- Find command “Help.UnityAPIReference”
- Assign a new shortcut.
For example: CTRL+ALT+’
In MonoDevelop, the shortcuts are CTRL+’ (Windows) or CMD+’ (Mac)
Adding a Button to The Toolbar: With the tighter integration with Visual Studio mentioned in the Unity 5.2 release notes, it’s fairly simple to add a button to the toolbar instead of using the shortcut keys. This may be possible in other versions, but I only decided to do this recently…
- Go to menu: View > Toolbars > Customize
- Click New
- Enter a name such as “API Reference”
- Click OK
- Go to Commands tab
- Select Toolbar
- Choose the new toolbar name in the dropdown
- Click Add Command
- Select the Help category
- Choose cmdIdUnityDocumentation
- Click OK
- There should now be a Unity API Reference button on the toolbar
Please see RedElijah’s comment if you would also like to change the API Reference to open in an external browser instead of inside a Visual Studio tab.
Searching Offline Docs:
By request, the below instructions provide a way to more easily search offline documentation. This uses external tools. Other options would be to build an add-in for Visual Studio (or MonoDevelop) or ask Unity to update the existing add-in.
- Open Visual Studio
- Go to the menu: Tools > External Tools
- Click the Add button
- Make note of how many external tools there are now (it will be needed later).
- Enter a Title:
Unity API Offline Search
- Enter path to your desired browser as Command:
C:\Program Files (x86)\Mozilla Firefox\firefox.exe
- Enter the URL below as Arguments:
- Leave empty: Initial Directory
- Leave unchecked: Prompt for arguments
- Click OK to save changes.
Replace “#” in the below two items with the number of external tools noted earlier.
- To add to toolbar as a button… follow steps earlier above on how to add the API reference button, but instead of the command “cmdIdUnityDocumentation” choose "External Command #” under the Tools category.
- To add a keyboard shortcut… go to Tools > Options > Environment: Keyboard and look for the command "Tools.ExternalCommand#”.
How To Use It?
Select the text you want to search then run the external tool with preferred method (toolbar button, shortcut key, or menu option).
Warning: The external tool runs as a command line argument. Avoid selecting quotes in search text as it will cause undesired behavior.
How To Setup In MonoDevelop?
It is in a slightly different menu location (mentioned below), but very similar to Visual Studio setup. I was unable to bind a key or create a button so you will need to run it from the menu option created.
- Go to the menu: Tools > Options > Environment: External Tools
In Visual Studio, ctrl+alt+m and then ctrl+h works for me.
I’m not totally sure what you mean by “get the help of the Unity API”, so I’m going to take a best guess here. Do you mean how to get Intellisense (Autocompletion) to expose the variables, properties, classes and methods available when you include the Unity namespaces? (UnityEngine, UnityEditor, etc)
If so, then the answer is that you need to set up Visual Studio as the IDE for Unity. You do this in Edit->Preferences->General tab->External Script Editor.
Make sure that’s set to Visual Studio. Unity will now open up scripts in Visual Studio when you click on the “Edit…”-button in the inspector, and the instance of Visual Studio that opens will have references to Unity’s assemblies, which is what enables the intellisense.
I use Visual Studio to edit my Unity C# scripts. And I often need to look the definition of the API used in my source code from the editor of Visual Studio without switching to the web browser. Visual Studio offers the convenient functionality to look the Windows API definitions in MSDN from the editor of Visual Studio by press F1 key.
There is a iniline document at the unity wiki for MonoDevelop & Visual Studio
But it seems support to unity 2.6
This worked for me : mark keyword in VS e.g. Input, press ‘Ctrl+Alt+M’ at the bottom of VS the message ‘Waiting for second key of chord.’ shows up, than press ‘Ctrl+H’ , the unity help window is loaded within VS.
For 2017 community is there a known bug with this ?
My VS has this behavior:
- ctrl+alt+m shows noting – I tried change to another key and still nothing
- ctrl+shift+m shows a popup window but no matter what i choose and hit OK, nothing happens
Here is the popup: http://myprintscreen.com/s/vu65/9966f1b597
Go to EDIT menu>>Preferences>>External Tools>>External Tools Editor>>choose Visual studio from drop down menu
If you want to assign your preferred key go to Debug menu>>Options>>Enviroment>>Keyboard>>Help.Unity.APIReference>>Press shortcut key>>Assign