How to add a description for a method?

Viewed 52

I have in one script this method :

public void StartFade(bool isIn, bool autoSwitch)
    {
        if (canvasGroup != null)
        {
            if (_currentRoutine != null)
            {
                if (_currentDirection != isIn)
                {
                    StopCoroutine(_currentRoutine);

                    _currentRoutine = StartCoroutine(Fade(canvasGroup, isIn, autoSwitch));
                }
            }
            else
            {
                _currentRoutine = StartCoroutine(Fade(canvasGroup, isIn, autoSwitch));
            }
        }
    }

then i'm calling this method in many other scripts like :

public void HoverOut()
    {
        fader.StartFade(false, false);
    }

when i type StartFade(

at this point i want to see some description of what the StartFade method do. now i only see :

method

2 Answers

What you're looking for are XML Documentation Comments. The Microsoft Docs for them are here

They allow you to comment on the method, and most IDE's will pick those comments up in their suggestion/autocompletion.

In this example, it would be something like:

/// <summary>
/// Your summary
/// </summary>
public void StartFade(bool isIn, bool autoSwitch)
{
    ...
}
/// <summary>
/// Description...
/// <para>New line description for method...</para>
/// </summary>
/// <param name="isIn">isIn description...</param>
/// <param name="autoSwitch">
/// autoSwitch description...
/// <para>New line description for autoSwitch parameter...</para>
/// </param>
/// <returns>Return description...</returns>
public void StartFade(bool isIn, bool autoSwitch)
{
}

enter image description here

Related