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 theDocumentationsscriptable 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 theDocumentationManagerby loading the documentation data.LoadDocumentationData(): Loads theDocumentationsasset 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.csfiles 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 theDocumentationsasset with the new documentation.
Last updated