DocumentationManager.cs

DocumentationManager

Overview

The DocumentationManager script is responsible for generating documentation for various scripts in a Unity project. It utilizes OpenAI's capabilities to create human-readable documentation from code files, making it easier for developers to understand the codebase. This script fits within the broader context of the project by automating the documentation process, ensuring that all scripts are well-documented and accessible.

Variables

  • documentations: A reference to the Documentations scriptable object that manages the documentation data.

  • systemPrompt: A string containing the instructions for the OpenAI model on how to generate documentation.

  • debug: A boolean flag that toggles debugging logs on or off.

Functions

  • DocumentationManager(): Static constructor that initializes the DocumentationManager by loading the documentation data.

  • LoadDocumentationData(): Loads the Documentations asset from the Resources folder and sets up the OpenAI API key.

  • CreateAllDocumentation(string scriptFolder, string outputFolder): Asynchronously creates documentation for all scripts in the specified folder. It searches for .cs files and processes each one to generate corresponding documentation files.

  • CreateDocumentation(string scriptPath, string outputFolder): Asynchronously generates documentation for a single script. It reads the script's content, sends it to OpenAI for processing, and saves the generated documentation as a Markdown file in the specified output folder. It also updates the Documentations asset with the new documentation.

Last updated