How demigiant/dotween works
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.