How orkuneser/mergemechanic works
Project type and purpose
• This is a Unity-based game project (“MergeMechanic”) whose core mechanic is merging items on a grid.
• The README simply points to a demo GIF, so most domain knowledge comes from the folder named [MergeMechanic] under Assets.
File structure
• Top-level:
• Assets/
• Packages/ (Unity Package Manifest and lock)
• ProjectSettings/ (Unity build/editor settings)
• Plugins & ThirdParty: DOTween, TextMeshPro, various editor tools (BOXOPHOBIC, Lean Touch, Hierarchy 2) all integrated as asmdef modules.
• Assets/[MergeMechanic]:
• Materials: tile & item materials
• Prefabs: item prefabs per level
• Scenes: one main sample scene
• Scripts/Data: ScriptableObject assets defining Item levels (Item0.asset…)
• Scripts/Runtime:
• ItemScripts: controllers (spawn, movement, merge), data classes (Item, ItemSO)
• TileScripts: controllers for tile behavior and ray interactions, Tile SO
• UI: Spawn button logic
• Utilities: Singleton base class
README
• No architectural text; it’s purely visual. File structure is your main guide.
a. Main components
• Unity Engine/Editor (host runtime & build pipeline)
• MergeMechanic module
– Data layer (ScriptableObjects under Scripts/Data)
– Runtime layer
· Item subsystem (Item controllers, models)
· Tile subsystem (Tile controllers, models)
· UI subsystem (SpawnButton)
· Utilities (Singleton)
• Asset layer (Materials, Prefabs, Scenes)
• External services/plugins
– DOTween (animation engine)
– TextMeshPro (UI text)
– ThirdParty editor-only tools (BOXOPHOBIC, Lean Touch) – note “Editor” vs “Runtime” asmdef
b. Relationships & interactions
• Scene loads Prefabs + assigns scripts
• UI → SpawnButton.cs invokes ItemSpawnController
• ItemSpawnController uses Data (ItemSO) to instantiate Prefabs
• ItemMovementController, ItemMergeController respond to user input (via Unity’s EventSystem or raycasts)
• TileRayController detects grid taps → routes to ItemRayController
• Merge logic updates Tile & Item state → triggers DOTween animations for movement/merge
• TextMeshPro renders any text feedback
• Utility Singleton used for any global managers
c. Architectural patterns
• MVC-like separation:
– Model = ScriptableObjects (ItemSO, Tile metadata)
– Controller = Runtime controllers handling input & game logic
– View = Prefabs + Animations (DOTween)
• Scriptable-Object data driven approach for levels/items
• Singleton for shared managers
d. Key technologies & frameworks
• Unity Engine (Scenes, GameObjects, components)
• C# scripts organized by asmdef
• DOTween for tweening/movement
• TextMeshPro for UI
• Editor-only modules for tooling
Detail
• Assembly definitions (asmdef) boundaries for clarity
• Both Editor-only and Runtime-only plugins
• Don’t be afraid to break out sub-modules (Item vs Tile vs UI vs Utilities)