# demigiant/dotween architecture

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

- Interactive diagram: https://gitdiagram.com/demigiant/dotween
- Repository: https://github.com/demigiant/dotween

## Overview

The DOTween project is essentially a tweening/animation engine built for Unity in C#. Its primary purpose is to provide a robust, high-performance system for animating properties in Unity. The file tree shows that the project is organized into several high‐level areas including runtime components (the core tween engine and its modules), Unity Editor integration (e.g. DOTweenEditor, DOTweenUpgradeManager), a set of examples and tests that demonstrate the engine’s usage in different Unity versions, and even multiple assembly builds (DOTween43, DOTween46, DOTween50) which allow for compatibility with different Unity versions and configurations.

##### Main Components
- Core Engine – This includes the central tween management logic, the Tween, Tweener, Sequence classes and the Tween Manager. It also includes core utilities such as DOTweenSettings, debugging tools, easing functions (placed in sub-packages), and safe mode handling.
- Modules & Plugins – These represent the additional functionality of DOTween. There are modules for supporting audio, physics, UI, and even custom plugin support (e.g., PureQuaternionPlugin). These modules extend the core engine and provide specialized tween behaviors.
- Editor Integration – A separate area exists for DOTweenEditor and related components (e.g. Editor Preview, Upgrade Manager). These are used in the Unity Editor to facilitate configuration, display settings, and provide a visual interface for the tweening setup.
- Assembly & Versioning – There are separate assembly projects (e.g. DOTween43, DOTween46, DOTween50) and a DOTweenUpgradeManager. These components allow the engine to be built and configured for different runtime requirements and Unity versions.
- Example Scenes and Tests – The file tree shows various Unity scenes, examples, and tests (under directories like UnityExamples, UnityTests, Win81CompatibilityTest) that serve to both validate and illustrate the usage of the engine.

##### Component Relationships and Interactions
- At runtime, the game code (scripts in a Unity project) interacts with the Core Engine to create and control tweens. The DOTween core then manages execution, scheduling, and updates through its Tween Manager.
- The Core Engine relies on various plugins (e.g. easing, path decoding plugins, module plugins) that encapsulate different tweening logic; these can be depicted as subordinate modules attached to the core.
- DOTweenSettings (usually found in the Resources folder) is used to configure defaults and is referenced by the core engine and sometimes the Editor.
- The Editor Integration components (Editor inspectors, upgrade manager) connect to the core engine to provide previews and custom configurations within the Unity Editor environment.
- The different assembly projects encapsulate builds that are then deployed for different versions or Unity requirements. They essentially share the same core architecture with version-specific tweaks.
- The test and example scenes illustrate real-world usages and are usually connected to the core functionality to demonstrate how the engine is consumed.

##### Architectural Patterns and Design Principles
- Layered Design – The engine is separated into layers: a runtime layer (core engine and its modules) and a design-time layer (editor integration, upgrade tools). This separation helps in maintaining the engine independently from the Editor.
- Plugin/Modular Architecture – Functionality is extended through plugins and modules that can be swapped or updated without altering core tween logic.
- Versioning / Compatibility – The provision of multiple assemblies (DOTween43, DOTween46, DOTween50) suggests a design that abstracts differences in Unity versions, ensuring backward and forward compatibility.

##### Technologies, Frameworks, and Dependencies
- Unity – The entire engine is built for Unity and uses Unity’s runtime, asset management (DOTweenSettings in Resources), and editor environment.
- C# and .NET – As a C# library, DOTween leverages .NET’s features.
- Custom build scripts and assembly definitions – Provided to handle different builds and editor vs. runtime separation.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Runtime Layer
    subgraph "Runtime Layer"
        GC["Game Client (Unity Scripts)"]:::client
        Core["Core Engine"]:::runtime
        TM["Tween Manager"]:::runtime
        Config["DOTweenSettings (Configuration)"]:::config
        subgraph "Modules & Plugins"
            CP["Custom Plugins"]:::plugin
            MP["Module Plugins"]:::plugin
        end
    end

    %% Design-Time Layer
    subgraph "Design-Time Layer"
        subgraph "Editor Integration"
            DE["DOTweenEditor"]:::editor
            UM["Upgrade Manager"]:::editor
        end
    end

    %% Assembly & Versioning
    subgraph "Assembly & Versioning"
        A43["DOTween43"]:::assembly
        A46["DOTween46"]:::assembly
        A50["DOTween50"]:::assembly
    end

    %% Examples & Tests
    subgraph "Examples & Tests"
        EX["Example Scenes (UnityExamples.Unity5)"]:::example
        UT["Unity Tests (UnityTests.Unity4/Unity5)"]:::example
        WT["Win81CompatibilityTest (Unity4)"]:::example
    end

    %% Connections in Runtime Layer
    GC -->|"calls"| Core
    Core -->|"manages"| TM
    Core -->|"uses"| CP
    Core -->|"uses"| MP
    Config -->|"configures"| Core

    %% Connections from Design-Time Layer to Core
    DE -->|"integrates"| Core
    UM -->|"upgrades"| Core

    %% Assembly connections
    Core -->|"built_into"| A43
    Core -->|"built_into"| A46
    Core -->|"built_into"| A50

    %% Example and Test connections
    EX -->|"demonstrates"| Core
    UT -->|"validates"| Core
    WT -->|"tests"| Core

    %% Styles
    classDef runtime fill:#9fdf9f,stroke:#333,stroke-width:2px;
    classDef client fill:#f99,stroke:#333,stroke-width:2px;
    classDef config fill:#ffc,stroke:#333,stroke-width:2px;
    classDef plugin fill:#ffd,stroke:#333,stroke-width:2px;
    classDef editor fill:#9fd,stroke:#333,stroke-width:2px;
    classDef assembly fill:#ff9,stroke:#333,stroke-width:2px;
    classDef example fill:#cff,stroke:#333,stroke-width:2px;

    %% Click Events
    click Core "https://github.com/demigiant/dotween/blob/develop/_DOTween.Assembly/DOTween/DOTween.cs"
    click TM "https://github.com/demigiant/dotween/blob/develop/_DOTween.Assembly/DOTween/Core/TweenManager.cs"
    click Config "https://github.com/demigiant/dotween/blob/develop/UnityExamples.Unity5/Assets/Resources/DOTweenSettings.asset"
    click CP "https://github.com/demigiant/dotween/tree/develop/_DOTween.Assembly/DOTween/Plugins"
    click MP "https://github.com/demigiant/dotween/tree/develop/_DOTween.Assembly/DOTween/bin/Modules"
    click DE "https://github.com/demigiant/dotween/tree/develop/_DOTween.Assembly/DOTweenEditor"
    click UM "https://github.com/demigiant/dotween/tree/develop/_DOTween.Assembly/DOTweenUpgradeManager"
    click A43 "https://github.com/demigiant/dotween/tree/develop/_DOTween.Assembly/DOTween43"
    click A46 "https://github.com/demigiant/dotween/tree/develop/_DOTween.Assembly/DOTween46"
    click A50 "https://github.com/demigiant/dotween/tree/develop/_DOTween.Assembly/DOTween50"
    click EX "https://github.com/demigiant/dotween/blob/develop/UnityExamples.Unity5"
    click UT "https://github.com/demigiant/dotween/blob/develop/UnityTests.Unity4"
    click WT "https://github.com/demigiant/dotween/blob/develop/Win81CompatibilityTest.Unity4"
```
