# tayx94/graphy architecture

> Architecture diagram of the GitHub repository tayx94/graphy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tayx94/graphy
- Repository: https://github.com/tayx94/graphy

## Overview

##### Project Type & Purpose
- It is structured as a Unity package with distinct separation of runtime functionalities, editor customizations, and asset resources (fonts, materials, shaders, prefabs).

##### Analyzing the File Structure
- Editor: Contains custom editor scripts like GraphyDebuggerEditor.cs, GraphyManagerEditor.cs, and custom style definitions. This indicates the presence of a custom Unity inspector and context menus for configuration.
- Runtime: Houses the core functionality of Graphy with separate subdirectories for modules such as Audio, Fps, Ram, Graph, Shader, UI, and Util. Each module has its own manager, monitor, and UI text/graph scripts.
- Other Directories: Fonts, Materials, Prefabs, Shaders, and GUI assets provide the required resources for rendering and visual customization in Unity.
- Assembly Definition files (.asmdef) in both Editor and Runtime denote that the code is modularized, which might affect dependency management and compilation.

##### Insights from the README
- The README confirms that Graphy is used to monitor FPS, memory, audio, and more, with advanced debugging and customization capabilities.
- Installation instructions imply that the package is used as a standard Unity asset and includes integrations with the Unity Package Manager.
- Emphasis on customization, extensibility, and modular design is clear from the separation between runtime functionalities and the editor extensions.

a. Main Components to Include:
- Graphy Manager (central orchestrator): Represents the high-level controller that interacts with all modules.
- Runtime Modules:
- FPS Module – includes components for FPS graph, monitor, manager, and text representation.
- Audio Module – includes audio graph, monitor, manager, and text components.
- RAM Module – includes RAM graph, monitor, manager, and text components.
- Additional Modules such as Advanced, Graph (for custom graphs), Shader (for graph rendering), and UI (e.g., safe area adjustments).
- Editor Modules:
- Graphy Editor scripts that allow customization in Unity’s editor. Show these as a separate block that configures and initializes runtime parameters.
- Resources:
- Assets like Fonts, Materials, Prefabs, Shaders, and GUI skins that support the visualization.

b. Relationships & Interactions:
- Feedback loops where modules update UI elements (graphs and text) in real-time.
- Dependencies on resource assets by indicating that runtime and editor modules require Fonts, Materials, Shaders, and Prefabs to render visual elements.

c. Architectural Patterns & Principles:
- Modular Design: Emphasize separation of concerns among multiple modules (FPS, Audio, RAM) and the clear division between editor and runtime assets.
- Extensibility: Since the package supports custom API calls and scene integration, note the openness for extension and integration with other systems.

d. Relevant Technologies & Frameworks:
- Unity framework as the runtime engine.
- Unity’s Assembly Definition files imply managed module boundaries.
- Use of custom shaders (GraphStandard, GraphMobile) and GUI skins for rendering.
- The presence of prefabs and Unity packages indicate component-based design patterns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    GM["Graphy Manager"]:::runtimeManager

    subgraph "Runtime Modules"
        FPS["FPS Module (Manager, Monitor, Graph, Text)"]:::runtime
        AUD["Audio Module (Manager, Monitor, Graph, Text)"]:::runtime
        RAM["RAM Module (Manager, Monitor, Graph, Text)"]:::runtime
        ADV["Advanced Module"]:::runtime
        GR["Graph Module (for custom graphs)"]:::runtime
        SHD["Shader Module (for graph rendering)"]:::runtime
        UIComp["UI Components (Safe Area, etc)"]:::runtime
        UTIL["Utility Functions"]:::runtime
    end

    subgraph "Editor Customization"
        ECT["Editor Customization Tools"]:::editor
        EAD["Editor Assembly Definition"]:::editor
    end

    subgraph "Resource Assets"
        FNT["Fonts"]:::asset
        MAT["Materials"]:::asset
        PREF["Prefabs"]:::asset
        SHA["Shaders Assets"]:::asset
        GUIE["GUI Elements"]:::asset
        RAD["Runtime Assembly Definition"]:::asset
    end

    ECT -->|"configures"| GM

    GM -->|"updates"| FPS
    GM -->|"updates"| AUD
    GM -->|"updates"| RAM
    GM -->|"updates"| ADV
    GM -->|"updates"| GR
    GM -->|"updates"| SHD
    GM -->|"updates"| UIComp
    GM -->|"updates"| UTIL

    GM -.->|"uses_Font"| FNT
    GM -.->|"uses_Materials"| MAT
    GM -.->|"uses_Prefabs"| PREF
    GM -.->|"uses_Shaders"| SHA
    GM -.->|"uses_GUI"| GUIE
    GM -.->|"uses_asm"| RAD

    ECT -.->|"assembly"| EAD

    click GM "https://github.com/tayx94/graphy/blob/master/Runtime/GraphyManager.cs"
    click FPS "https://github.com/tayx94/graphy/tree/master/Runtime/Fps"
    click AUD "https://github.com/tayx94/graphy/tree/master/Runtime/Audio"
    click RAM "https://github.com/tayx94/graphy/tree/master/Runtime/Ram"
    click ADV "https://github.com/tayx94/graphy/tree/master/Runtime/Advanced"
    click GR "https://github.com/tayx94/graphy/tree/master/Runtime/Graph"
    click SHD "https://github.com/tayx94/graphy/tree/master/Runtime/Shader"
    click UIComp "https://github.com/tayx94/graphy/tree/master/Runtime/UI"
    click UTIL "https://github.com/tayx94/graphy/tree/master/Runtime/Util"
    click ECT "https://github.com/tayx94/graphy/tree/master/Editor"
    click EAD "https://github.com/tayx94/graphy/blob/master/Editor/Tayx.Graphy.Editor.asmdef"
    click FNT "https://github.com/tayx94/graphy/tree/master/Font"
    click MAT "https://github.com/tayx94/graphy/tree/master/Materials"
    click PREF "https://github.com/tayx94/graphy/tree/master/Prefab"
    click SHA "https://github.com/tayx94/graphy/tree/master/Shaders"
    click GUIE "https://github.com/tayx94/graphy/tree/master/GUI"
    click RAD "https://github.com/tayx94/graphy/blob/master/Runtime/Tayx.Graphy.asmdef"

    classDef runtimeManager fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef runtime fill:#B0C4DE,stroke:#000,stroke-width:1px;
    classDef editor fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef asset fill:#FFFF99,stroke:#000,stroke-width:1px;
```
