- Home /
How can I add a summary to a function (void)?
I was wondering if it were possible to add a custom summary to my function so when I type in my function name (KillUser), the autocorrect box will display the parameters it needs and a summary below it which displays information about it. Is that possible for a function? THanks
Answer by mattyman174 · May 11, 2014 at 02:35 AM
Not sure if MonoDevelop supports this.
/// <summary>
/// Returns 1 if passed true or -1 if passed false.
/// </summary>
/// <param name="myBool">Parameter value to pass.</param>
/// <returns>Returns an integer based on the passed value.</returns>
private int MyFunction(bool myBool)
{
if (myBool)
return 1;
else
return -1;
}
Using the triple / will cause the IDE to create a Function Summary block above the function. As you begin to write the function call you will notice it shows you the summary and parameter descriptions.
Could you please accept this as correct to close the Question, thanks.
Answer by J0hn4n · Jan 21, 2017 at 06:51 AM
There is also [Tooltip("Describe the tip")] for public stuff.
That works for describing public (or private/protected with [SerializeField]) attributes on a component when viewed in the inspector.
Attributes are no functions, though, so not quite what the OP asked about. Still useful to know I guess.