> For the complete documentation index, see [llms.txt](https://indie-4.gitbook.io/one-click-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://indie-4.gitbook.io/one-click-documentation/documentationeditor.cs.md).

# DocumentationEditor.cs

## DocumentationEditor

### Overview

The `DocumentationEditor` script is a Unity Editor window that facilitates creating and managing documentation for scripts within a Unity project. It allows users to specify folders for input scripts and output documentation and provides options to generate documentation for all scripts or a single script. This script integrates with the `DocumentationManager` to handle the actual documentation generation process, making it a crucial component for maintaining clear and organized documentation in the codebase.

### Variables

* `isRunning`: A boolean flag that indicates whether the documentation generation process is currently running. This helps to manage user interactions and prevent multiple simultaneous operations.
* `settings`: An instance of `DocumentationSettings` that holds the folder paths for the input scripts and output documentation. It is loaded or created when the editor window is enabled.
* `scriptToReference`: A reference to a `MonoScript` object that allows the user to select a specific C# script for generating documentation.

### Functions

* `ShowWindow()`: A static method that opens the Documentation Manager window in the Unity Editor. This is triggered by a menu item in the Tools section.
* `OnEnable()`: This method is called when the editor window is enabled. It loads or creates the `DocumentationSettings` asset, ensuring the necessary settings are available for documentation.
* `OnGUI()`: This method is responsible for rendering the user interface of the Documentation Manager. It includes options to select folders, buttons to create documentation, and displays the current state of the documentation process.
* `RunAllDocumentationProcess()`: An asynchronous method that handles the documentation generation for all scripts in the specified folder. It checks for valid folder paths, invokes the `DocumentationManager` to create documentation, and manages the running state of the process.
* `RunOneDocumentationProcess()`: An asynchronous method that generates documentation for a single selected script. Similar to `RunAllDocumentationProcess`, it checks for valid paths and calls `DocumentationManager` to create the documentation for the specified script.

By providing a user-friendly interface and integrating with the existing documentation management system, the `DocumentationEditor` script enhances the overall documentation process within the Unity project.
