Skip to content

volkanerden/Unity-Grid-Editor-2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2048: Technical Implementation & Custom Editor Tools

A highly modular implementation of the classic 2048 puzzle game, developed in Unity/C#. This project serves as a technical showcase for custom Unity Editor extensions, event-driven architecture, and automated grid generation.

Technical Highlights

1. Custom Editor & Data Tooling (BoardDataEditor.cs)

The standout feature of this project is the custom Inspector tool. Instead of manually placing tiles, I developed a Board Data Editor that allows developers to:

  • Dynamically resize the grid (Rows/Columns) via the Inspector.
  • Toggle individual cell states using an interactive boolean toggle matrix.
  • Automate Grid Persistence: Uses ScriptableObjects to save level configurations, separating game data from logic.

2. Event-Driven Architecture

I utilized the company's custom EventSystem (via Holago.SystemContainer) to decouple game components.

  • Input vs. Logic: InputHandler.cs captures gestures and broadcasts events, ensuring that the BoardManager doesn't need to "poll" for input.
  • State Management: Actions like OnMovesCompleted and OnMergeStarted trigger UI updates and sound-ready hooks without direct class dependencies.

3. Clean Code & Design Patterns

  • Factory Pattern (TileFactory.cs): Used to abstract the instantiation of tile prefabs, ensuring consistent initialization.
  • Separation of Concerns: Distinct controllers for Cells, Tiles, and Input ensure the codebase is modular and easy to debug.
  • Tween-Based Feedback: Integrated DOTween for optimized, non-blocking animations (scaling and movement), providing a polished "juice" to the user experience.

4. Logic & Algorithms

  • Recursive Grid Traversal: Implemented a robust movement algorithm in BoardManager.cs that handles multi-tile shifts and merges in a single directional swipe.
  • Dynamic Spawn Logic: TileGenerator.cs manages empty-cell detection and weighted random spawning of new tiles.

Languages & Tools

  • Language: C#
  • Engine: Unity
  • Tooling: Unity Editor Scripting (CustomEditor)
  • Libraries: DOTween (Animation Management)

About

A modular 2048 implementation featuring a custom Unity Inspector tool for dynamic grid generation. Implements ScriptableObject-based data persistence and event-driven game logic.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages