Unity Match-3: VContainer Edition
A modern Match-3 puzzle game built in Unity, focusing on clean architecture, dependency injection, and data-driven design. This project serves as a template for scalable mobile game development.
🏗 Architecture & Patterns
Dependency Injection with VContainer
This project utilizes VContainer for high-performance dependency injection. By using a LifetimeScope, we decouple our game logic (Grid Management, Scoring, Input) from the Unity Lifecycle, making the codebase more modular and easier to test.
Data-Driven Gameplay
All balancing and configuration parameters are centralized in a ScriptableObject called GameVariables. This allows designers to tweak the game feel in real-time without touching code.
Adjustable Parameters include:
- Debug Mode
- Tile prefabs
- Spawnable object
- Spawnable explosion prefab animation
- Sprite
- Score value
- Grid Dimensions
- Audio SFX
- Special Tiles
- Animation speed and delays
🎮 Features
- Grid Logic: Efficient recursive algorithms for detecting matches and handling "gravity" (falling tiles).
- Decoupled Systems: UI, Sound, and Gameplay systems communicate via injected interfaces.
- Scriptable Configuration: Easily swap between "Easy" and "Hard" mode by swapping the
GameVariablesasset.
🛠 Tech Stack
- Engine: Unity 2022.3+
- DI Framework: VContainer
- UniTask: C# (Task-based async for animations)
- Data: ScriptableObjects
🚀 Getting Started
Prerequisites
- Unity Hub & Unity 2022.3 LTS or newer.
- VContainer package.
- UniTask package.
Installation
- Open the project in Unity.
- Navigate to Assets/Scenes/ and open
Scene_Submission - Locate
GameVariablesasset inAssetsto modify gameplay values.
Description
Languages
C#
38.9%
ShaderLab
30.6%
GLSL
21.5%
HLSL
9%