The way in which I was writing comments for my functions was consistent, but entirely in my own style. I knew there must be a better way of creating this documentation using a more standard coding convention. Indeed there is.

Using triple slashes and the format for XML comments, your explanation will be viewable when you using that function, through a tooltip. Those familiar with Visual Studio know this auto-completing feature as IntelliSense. Which parameter is displayed is dependent on where your cursor is located within the function call, as shown in the screenshot below:

Unity Tip - Parameter Comments with XML

 XML Comment Format

Here is a basic example of the code, for your copy-pasting. You could use only one of the following XML tags if you wanted. There are other recommended tags available too, such as remarks and para. Another great thing about using this format, is that there are tools available to generate documentation based upon it.

More Info

Leave a Reply

You can use the <pre> tag to post a block of code, or <code> to highlight code within text.