This is the public repository of the Comment To Tooltip asset for Unity: https://assetstore.unity.com/packages/tools/utilities/comment-to-tooltip-120659
Comment To Tooltip automatically generates new tooltips, or updates existing ones, directly from your code comments.
The Comment To Tooltip menu is available under Tools → ToolBuddy in the Unity menu bar.
It provides the following options:
- Process a file: Processes a single
.csfile. - Process a folder: Recursively processes all
.csfiles in a folder. - Preferences: Choose which types of comments to process. The more options you select, the longer the processing time will be.
- Help: Opens ReadMe.txt
- Single-line documentation (
///): Extracts text from<summary>…</summary>blocks. - Delimited documentation (
/* … */): Extracts text from<summary>…</summary>blocks. - Single-line comments (
//): Uses contiguous lines of comments immediately above a field.
Regular expressions are used to capture:
- documentation lines
- any existing
Tooltipattribute - the public field declaration line
The code then updates an existing tooltip or inserts a new one if none is present.
VContainer is used for DI. The composition root is defined in EditorCompositionRoot.
- The code relies on regex for parsing. Although relatively robust, it is not as accurate as a full C# parser such as Roslyn.
- This design choice was made to support single-line comments (
//). - In the future, a hybrid approach may be implemented: using Roslyn for documentation comments, and regex for single-line comments.
- Test data is located under:
Assets/Plugins/ToolBuddy/Assets/CommentToTooltip/Tests/TestData/
Each test includes an input file (.input.cs.txt) and an expected output file (.expected.cs.txt). - Run tests via the Unity Test Runner under the
ToolBuddy.CommentToTooltip.Testsassembly. - Continuous integration runs EditMode tests via
.github/workflows/editor-tests.yml.
See LICENSE.md
See CHANGELOG.md