Documentations.cs
Documentations
Overview
The Documentations
script is a Unity ScriptableObject designed to manage a collection of Markdown (.md) files within the Indie Documentation framework. It acts as a centralized repository for documentation assets, allowing for easy retrieval, addition, updating, and deletion of documentation entries. This script integrates with the DocumentationManager
, providing a structured way to handle documentation files in a Unity project.
Variables
debug: A boolean flag that determines whether debug messages are logged to the console. When set to true, it provides feedback on operations performed on the documentation dictionary.
documentations: A dictionary that maps string keys (representing documentation identifiers) to
TextAsset
values (representing the actual Markdown documentation files). This allows for efficient storage and retrieval of documentation content.
Functions
GetDocumentation(string key):
Retrieves a
TextAsset
from thedocumentations
dictionary using the provided key. If the key exists, it logs a success message and returns the corresponding documentation. If the key does not exist, it logs a failure message and returns null.
AddOrUpdateDocumentation(string key, TextAsset text):
Adds a new documentation entry or updates an existing one in the
documentations
dictionary. If the key already exists, it updates the associatedTextAsset
and logs a message indicating the update. If the key does not exist, it adds the new entry and logs a message indicating the creation.
DeleteDocumentation(string key):
Removes a documentation entry from the
documentations
dictionary using the provided key. If the key exists, it deletes the entry and logs a message indicating the deletion. If the key does not exist, it logs a message indicating that the documentation was not found.
PrintAllKeys():
Logs all the keys present in the
documentations
dictionary to the console. This function serves as a helper to quickly view all available documentation identifiers.
Last updated