# truong0111/percasbuildhelper architecture

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

- Interactive diagram: https://gitdiagram.com/truong0111/percasbuildhelper
- Repository: https://github.com/truong0111/percasbuildhelper

## Overview

##### Project type and purpose
- This is a Unity Editor extension package (“Percas Build Helper”) that provides build‐management, versioning and runtime performance utilities for Android games.
- It installs via Unity Package Manager and consists of two halves: Editor scripts (Build/Version/Validator UIs and workflows) and Runtime scripts (performance watching and utility toggles).

##### File structure
- Top-level:
- Editor/ – contains all .cs Editor scripts and asmdef for the editor assembly
- Runtime/ – contains runtime utilities, settings ScriptableObjects and asmdef for the runtime assembly
- package.json – Unity package manifest
- README.md – describes features and usage
- Under Editor/BuildHelper: classes for configuring and invoking Unity’s build pipeline (ConfigBuild, PercasBuilder), UI windows (PercasEditor), data containers (PercasConfigSO, PercasUtilitySO).
- Under Editor/Validator: simple pre‐build checks.
- Under Runtime: PercasRuntimeSettingsSO holds runtime configuration; PercasUtility provides in‐game performance stats UI and utility controls.

##### README for further insights
- Instructions on how to import via Package Manager and how to operate each feature.

a. Main components
- Unity Editor Host
- Percas Editor Plugin
- Build Management UI
- Version Management UI
- Validator subsystem
- ScriptableObject assets (PercasConfigSO, PercasUtilitySO)
- Unity Build Pipeline & Android SDK (external service)
- Percas Runtime Library
- Performance Monitor UI
- Utility toggles (time scale, FPS limit, logs)
- ScriptableObject settings (PercasRuntimeSettingsSO)
b. Relationships and interactions
- Editor UI invokes PercasBuilder which calls UnityEditor.BuildPipeline API, passing ConfigBuild settings (keystore, output folder, naming).
- Version UI updates PlayerSettings.version and PlayerSettings.bundleVersionCode.
- Validator runs pre‐build checks on project settings/assets.
- On install, Package Manager registers the Percas.Editor and Percas.Runtime assemblies.
c. Architectural patterns and principles
- Separation of concerns: Editor‐only tooling vs Runtime performance code.
- Data driven via ScriptableObjects for both build and runtime settings.
- Use of Unity Package Manager asmdef files to define clear assembly boundaries.
d. Technologies and frameworks
- Unity Editor Scripting API
- UnityEngine.Profiling for performance metrics
- Android SDK / JDK for build signing
- Unity Package Manager for distribution

##### Elements
- Clear component labels (e.g., “Build Management UI”, “PercasBuilder”, “PercasRuntimeSettingsSO”)
- From UI → Builder → BuildPipeline → Android SDK
- From Version UI → PlayerSettings
- At runtime: PercasUtility → Profiling APIs → On-screen UI
- Runtime scripts in another
- External systems (Android SDK, Unity APIs) in a third

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Editor Layer
    subgraph "Editor Layer"
        direction TB
        PE[Percas Editor Plugin]:::editor
        click PE "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/Percas.Editor.asmdef"
        PI[Package Initializer]:::editor
        click PI "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/Percas/PercasPackageInitializer.cs"
        subgraph "Build Management UI"
            direction TB
            BMU[Build Management UI]:::editor
            click BMU "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/PercasEditor.cs"
        end
        subgraph "Version Management UI"
            direction TB
            VMU[Version Management UI]:::editor
            click VMU "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/PercasEditor.cs"
        end
        subgraph "Validator Subsystem"
            direction TB
            VAL[Validator]:::editor
            click VAL "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/Validator/Validator.cs"
        end
        subgraph "Build Pipeline Integration"
            direction TB
            PB[PercasBuilder]:::editor
            click PB "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/PercasBuilder.cs"
            CB[ConfigBuild]:::editor
            click CB "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/ConfigBuild.cs"
            CT[Constants]:::editor
            click CT "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/Constants.cs"
            EU[EditorUtils]:::editor
            click EU "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/EditorUtils.cs"
        end
        subgraph "ScriptableObjects (Editor)"
            direction TB
            CS[PercasConfigSO]:::editor
            click CS "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/PercasConfigSO.cs"
            USO[PercasUtilitySO]:::editor
            click USO "https://github.com/truong0111/percasbuildhelper/blob/main/Editor/BuildHelper/PercasUtilitySO.cs"
        end
    end

    %% Runtime Layer
    subgraph "Runtime Layer"
        direction TB
        RL[Percas Runtime Library]:::runtime
        click RL "https://github.com/truong0111/percasbuildhelper/blob/main/Runtime/Percas.Runtime.asmdef"
        subgraph "Runtime Components"
            direction TB
            RSS[PercasRuntimeSettingsSO]:::runtime
            click RSS "https://github.com/truong0111/percasbuildhelper/blob/main/Runtime/PercasRuntimeSettingsSO.cs"
            PU[PercasUtility]:::runtime
            click PU "https://github.com/truong0111/percasbuildhelper/blob/main/Runtime/PercasUtility.cs"
        end
    end

    %% External Systems
    UBAPI["UnityEditor.BuildPipeline API"]:::external
    PS["PlayerSettings API"]:::external
    SDK["Android SDK / JDK"]:::external
    PROF["UnityEngine.Profiling API"]:::external
    DOC[README.md]:::external
    click DOC "https://github.com/truong0111/percasbuildhelper/blob/main/README.md"
    MAN[package.json]:::external
    click MAN "https://github.com/truong0111/percasbuildhelper/blob/main/package.json"

    %% Connections
    BMU -->|"invoke"| PB
    PB -->|"uses Config"| CB
    PB -->|"calls BuildPipeline"| UBAPI
    UBAPI -->|"executes build on"| SDK
    VMU -->|"sets version code/name on"| PS
    VAL -->|"performs checks on project"| PS
    PE --> BMU
    PE --> VMU
    PE --> VAL
    PE --> PB
    PE --> CS
    PE --> USO
    RL -->|reads settings from| RSS
    RL -->|"hooks into"| PROF
    PROF -->|provides data to| PU
    PU -->|renders runtime UI| RL

    %% Styles
    classDef editor fill:#D6EAF8,stroke:#3498DB,color:#154360;
    classDef runtime fill:#E8F8F5,stroke:#1ABC9C,color:#0E6251;
    classDef external fill:#FDEDEC,stroke:#E74C3C,color:#641E16;
```
