# ryookazaki/conversationgemini architecture

> Architecture diagram of the GitHub repository ryookazaki/conversationgemini, 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/ryookazaki/conversationgemini
- Repository: https://github.com/ryookazaki/conversationgemini

## Overview

- Displaying a conversation scene (“ConversationGemini.unity”) where a Gemini API key is input to allow voice or text-based interactions.
- Integrating external modules and plugins designed for VR headsets, including Oculus/Meta Quest SDK components and XR settings.

##### Main components
- Unity Runtime & Engine: Representing the core Unity engine that orchestrates scene creation, asset loading, animation, physics, and rendering.
- Scenes & GameObjects: Emphasize the “ConversationGemini” scene. Within the scene, include the key ConversationSystem object with its GeminiAPIAccess component where the GeminiAPIKey is entered.
- XR / VR Subsystem: Highlight the XR plugin modules (in the XR folder, Oculus Loader, and XR Settings from ProjectSettings) – these are responsible for device input, tracking, and display on Meta Quest devices.
- External Services: Identify external network communication with the Gemini API (since it requires internet connectivity and API key configuration).
- Build and Deployment Configuration: Note the Android build configuration files (from Assets/Settings and ProjectSettings, plus Android manifest under Plugins/Android) that are used to deploy the project to specific devices (like Meta Quest3).

##### Relationships and Interactions
- The Unity engine loads the “ConversationGemini” scene, which is populated with the ConversationSystem GameObject.
- The GeminiAPIAccess component in the scene acts as a bridge between the Unity application and the external Gemini API, requiring a valid API key for operation and communicating with remote servers.
- XR systems (driven by Oculus/Meta plugins) interact with Unity’s rendering and input systems to manage VR display and device controller input.
- The VRM and UniGLTF components work as middleware to import, rig, and animate 3D avatars. They interface with Unity’s asset pipeline and supporting editor tools.
- Build and configuration files ensure that platform-specific functionality (Android/Meta Quest3) is properly packaged and deployed.

##### Architectural Patterns or Design Principles
- Modular divide-and-conquer: Separate scene logic (ConversationScene), platform-specific modules (XR, plugins), external network services (Gemini API), and asset management (VRM imports).
- Dependency injection/configuration at the scene level – using the Inspector to input the API key – reinforces a clean separation between configuration and runtime behavior.
- Use of standard Unity practices such as the component-based design (for GeminiAPIAccess, XR input scripts, etc.) is evident across the project.

##### Relevant Technologies
- Unity Engine, C# scripts.
- XR/VR technologies (Oculus/Meta Quest and related XR Manager settings).
- VRM and UniGLTF frameworks for avatar and 3D model handling.
- Android build tools related to Unity’s Android deployment.
- Networking libraries (likely built into Unity or custom ones) to communicate with external APIs like Gemini’s.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Engine"
        UE["Unity Engine"]:::core
    end

    subgraph "Game Scene"
        convScene["Conversation Scene"]:::scene
        apiAccess["GeminiAPIAccess (ConversationSystem)"]:::component
    end

    subgraph "XR/VR Integration"
        xr["XR/VR Subsystem"]:::xr
    end

    subgraph "External Communication"
        geminiAPI["Gemini API (External Service)"]:::external
    end

    subgraph "Asset & Plugin Management"
        vrm["VRM & Avatar Integration"]:::plugin
        unigltf["UniGLTF Module"]:::plugin
    end

    subgraph "Build & Deployment Config"
        BuildProfile["Build Profile (Meta Quest3)"]:::build
        AndroidManifest["AndroidManifest.xml"]:::build
    end

    UE -->|"loads"| convScene
    convScene -->|"includes"| apiAccess
    apiAccess -->|"API_call/response"| geminiAPI
    UE -->|"integrates"| xr
    xr -->|"VR_input"| convScene
    UE -->|"asset_import"| vrm
    UE -->|"asset_import"| unigltf
    UE -->|"builds"| BuildProfile
    UE -->|"packaging"| AndroidManifest

    click convScene "https://github.com/ryookazaki/conversationgemini/blob/main/Assets/Scenes/ConversationGemini.unity"
    click apiAccess "https://github.com/ryookazaki/conversationgemini/blob/main/Assets/Scripts/GeminiAPIAccess.cs"
    click xr "https://github.com/ryookazaki/conversationgemini/tree/main/Assets/XR"
    click geminiAPI "https://github.com/ryookazaki/conversationgemini/blob/main/Assets/Scripts/GeminiSender.cs"
    click vrm "https://github.com/ryookazaki/conversationgemini/tree/main/Assets/VRM"
    click unigltf "https://github.com/ryookazaki/conversationgemini/tree/main/Assets/UniGLTF"
    click BuildProfile "https://github.com/ryookazaki/conversationgemini/blob/main/Assets/Settings/Build Profiles/MetaQuest3.asset"
    click AndroidManifest "https://github.com/ryookazaki/conversationgemini/blob/main/Assets/Plugins/Android/AndroidManifest.xml"

    classDef core fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef scene fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef component fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef xr fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef external fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef plugin fill:#e2e3e5,stroke:#383d41,stroke-width:2px;
    classDef build fill:#fde2e2,stroke:#d9534f,stroke-width:2px;
```
