Jig Sort

A Jigsaw Colour-Sorting Puzzle — Unity Template

Version 0.1.0 | Unity 6+ | URP

🌟 This asset was made with the HyperCasual Game Engine!   Check it out — mobile puzzle templates & more. Click here to learn more ➔

Important: Template / Starting Point

This asset is designed as a template and starting point for your own game development. It provides the core systems, architecture, and tools needed to build a jigsaw colour-sorting puzzle game. You are expected to customize, extend, and modify this template to create your unique game. This is not a complete, ready-to-publish game — it's a foundation for developers to build upon.

Single-Folder Layout

Everything ships under one top-level folder, Assets/Jig Sort/ (single-folder Asset Store publishing). The shared win / lose / booster / developer-mode UI stack (originally the "NewestDevUI" package) is folded into the game folder — its scripts live in Scripts/, prefabs in Prefabs/, and its setup wizard is at Tools → NewestDevUI → Setup Wizard. After importing, run that wizard first (it builds the UI into the scene), then Tools → Jig Sort → Setup Wizard.

Overview

Jig Sort is a relaxing jigsaw colour-sorting puzzle. Each level shows a vertical stack of empty colored boxes and a bottom tray of loose jigsaw-quadrant pieces. The player drags each quadrant into the box of its matching colour; when all four quadrants of a box are in place the picture snaps together, a glass cap sweeps over it, star particles burst, and the box clears. Complete every box to win. The game ships with three boosters, a visual level editor, an automatic level generator, and a starter pack of 500 hand-tuned / generated JSON levels.

Drag-to-Sort Jigsaw Puzzles

Drag colour-coded quadrant pieces from the tray into matching-colour boxes. Each box needs its four quadrants (top-left, top-right, bottom-left, bottom-right) before it completes — pieces only fit their own cell.

Solvable By Construction

Every level's tray is the exact complement of its boxes — never a missing or surplus piece. All boxes are visible at level start, so there is always a valid move and no dead ends.

Visual Level Editor

A full Unity Editor window with a level list, per-box colour selection, a per-box picture picker that shows the real target image split into its 4 jigsaw quadrants, mystery-box toggles, per-level booster counts, and one-click Save All / Reload.

Auto Level Generator

Batch-generate fresh levels with a fast concave difficulty curve, configurable box count, colour variety, random picture assignment, booster allowances, and a mystery-box difficulty ramp. Append-only — never overwrites hand-tuned levels.

Three Boosters

Shuffle (re-randomise the whole tray incl. top/under), Magical Fill (pull a box's pieces in along curved trails), and Hint (animated ghost showing a valid move). Each is level-gated and shows a one-time tutorial popup on first use.

Mystery Boxes

Optional hidden boxes that show a greyed “?” and reject pieces until a set number of other boxes clear, then reveal their real colour + picture with a pop. Per-level in the editor; difficulty-ramped in the generator.

Stacked Tray Pieces

Some loose pieces spawn as a greyed piece tucked below + behind a front piece, locked until the front one is placed — then it surfaces to full colour with a pop and becomes draggable.

JSON Levels + 500-Level Starter Pack

Levels ship as plain JSON under Assets/Jig Sort/Resources/Levels/. Regenerate or extend at any time with the Auto Level Generator.

Getting Started

Requirements

Installation

  1. Import the Jig Sort package — one self-contained folder that includes the shared win / lose / booster / developer-mode UI stack (namespace HypercasualGameEngine).
  2. Ensure the project uses the Universal Render Pipeline (Edit > Project Settings > Graphics).
  3. Open the game scene at Assets/Jig Sort/Scenes/GameNew.unity.
  4. Run Tools > NewestDevUI > Setup WizardRun All Steps — it builds the Canvas, HUD, win/lose panels, booster popups and developer-mode button into the scene.
  5. Run Tools > Jig Sort > Setup WizardRun All Steps — it creates the SoundManager / GameManager, auto-wires audio, applies the Player & Build settings, and retargets post-processing.
  6. Press Play to test the first level.

Quick Test

Once in Play mode, drag a tray piece onto its matching-colour box cell. When all four quadrants of a box sit in their cells, the picture assembles, SoundManager.Instance.PlayLevelClear()-adjacent feedback plays, and the box clears. Clear every box to win — the next level loads automatically. Press the / arrow keys in Play mode to jump between levels for QA.

Folder Structure

During development the package is two top-level folders. The Jig Sort folder holds all game-specific content; NewestDevUI holds the shared UI stack (folded into Jig Sort before Asset Store publishing).

Jig Sort/ │ ├── Art/ — Sprite artwork (jigsaw pieces, themed pictures, HUD) │ ├── Audio/ — Sound effects (pickup, place, box complete, blocked, boosters, win, fail) │ ├── Datas/ — BlockData / ColorData ScriptableObjects (sprite + colour mappings) │ ├── Documentation/ — This documentation file │ ├── Editor/ │ ├── LevelEditorWindow.cs — Visual level designer │ ├── AutoLevelGeneratorWindow.cs — Automatic batch level generator │ ├── JigSortSetupWizard.cs — Idempotent scene / settings / audio / post-processing wizard │ ├── JigSortWelcomePopup.cs — Welcome popup on project open │ ├── BlockDataEditor.cs — Custom inspector for BlockData (3×3 cell painter) │ └── InputSystemCheck.cs — Warns if Active Input Handling is not set to Both │ ├── Materials/ — Shared materials for pieces and FX │ ├── Prefabs/ — Block, BoxSprite, ImageComplete, glass, particle prefabs │ ├── Resources/ │ ├── BlockOutline.shader — 2D sprite outline (load-bearing location; survives stripping) │ └── Levels/ — JSON levels (Level_1.json … Level_500.json) │ ├── Scenes/ │ └── GameNew.unity — Main game scene (single playable scene) │ ├── Scripts/ — Runtime scripts (namespace JigSort.Scripts; LevelManager/SoundManager in HypercasualGameEngine) │ ├── GameLevel.cs — Box + tray spawn, drag/place, completion, win/lose, boosters │ ├── InputManager.cs — Touch / mouse drag handling (new Input System) │ ├── Block.cs — A jigsaw quadrant piece (type, colour, grid cell, sprites) │ ├── Box.cs — A colored 2×2 target box │ ├── BlockData.cs — Block-type → cell footprint + sprite mapping │ ├── ColorData.cs — ColorType → colour + picture-sprite mapping │ ├── ImageComplete.cs — Completed-picture overlay │ ├── LevelData.cs — Level schema (boxes, supply, 3 booster counts) │ ├── LevelManager.cs — Static JSON loader + level progression (HypercasualGameEngine) │ ├── SoundManager.cs — SFX singleton (HypercasualGameEngine) │ ├── JigSortGameManager.cs — Scene orchestrator + win/lose choke point + dev hotkeys │ ├── OutlineController.cs — Toggles the sprite outline on the dragged piece │ └── CameraSwitcher.cs — Shared camera helper (HypercasualGameEngine) │ ├── PostProcessing/ — HC-PostProcessing-Volume.asset (shared URP profile, unique GUID) │ ├── Sprites/ — Block / quadrant sprite atlases │ └── Textures/ — Background and HUD textures NewestDevUI/ — shared UI stack (folded into Jig Sort/ before Asset Store publish) ├── Editor/ — NewestDevUI Setup Wizard + welcome popup ├── Scripts/ — LoseWinPanelManager, BoosterManager, DeveloperModeButton, DeveloperSettingsController ├── Prefabs/ — GameHUD_Panel, LevelClearedPanel, GameOverPanel, Popup_Powerup_Picker, DeveloperModeButton, … └── Textures/ — Booster icons + decorations

Gameplay

Core Mechanics

Each level displays a vertical stack of empty colored 2×2 boxes down the centre, flanked by two side columns of loose jigsaw-quadrant pieces. The player drags a piece onto a box; it only fits the box of its own colour, and only the cell matching its quadrant (top-left, top-right, bottom-left, bottom-right). When all four quadrants of a box are placed, the picture assembles and the box clears.

Piece Colours

Colours are defined by the ColorType enum (LevelData.cs) and mapped to RGB + picture sprites in the ColorData asset. A sample of the palette:

Color KeyColor
Red Red
Green Green
Blue Blue
Yellow Yellow
Orange Orange
Pink Pink

Win & Lose Conditions

Animations & Feedback

Pieces lerp to their target cells; the box pulses on each fill; a glass cap scales over the completed picture and star particles burst. The dragged piece shows a 2D sprite outline (OutlineController + Resources/BlockOutline.shader) and the target box highlights white while a piece hovers over it.

Scripts Reference

Game-specific runtime scripts use the JigSort.Scripts namespace; editor scripts use JigSort.Editor. The static LevelManager and the SoundManager singleton live under HypercasualGameEngine so the shared NewestDevUI scripts resolve against them. The win/lose, booster, and developer-mode scripts are provided by the NewestDevUI package (also HypercasualGameEngine).

Core Scripts (Jig Sort)

ScriptDescription
GameLevelMain gameplay controller. Pulls the current level from LevelManager.GetCurrentLevel() (no Inspector fallback), spawns the boxes and the data-driven tray supply, validates and animates drag-placement, detects box completion, routes win/lose through the GameManager, and implements the three booster effects (ShuffleSupply, BombFillRandomBox, UnlockNextSupplyPiece).
InputManagerTouch / mouse drag handling via the new Input System. Raycasts the Canvas to pick a tappable piece, tracks the drag with a ghost preview, fires the pickup SFX, applies the outline, and hands off to GameLevel.DragBlockTo on release.
BlockA jigsaw quadrant piece. Stores typeIndex (1–4), blockType (sprite), colorType, target gridPosition, the lock list (blockReleases), and rendering components.
BoxA colored 2×2 target box; holds its colour and the list of placed quadrants.
LevelDataLevel schema (ScriptableObject, JSON-serialised). Contains the box columns, the tray supply, and the three booster counts (shuffleBoosterCount, bombBoosterCount, unlockBoosterCount). Runtime instances get HideFlags.HideAndDontSave to survive scene reloads.
JigSortGameManagerScene orchestrator ([DefaultExecutionOrder(-100)]). Pre-warms the level cache, creates missing infrastructure with FindFirstObjectByType, owns the single TriggerWin() / TriggerLose() choke point (plays the clear/fail sound, flips state, then forwards to the panel), drives arrow-key dev level navigation, and forwards booster effects.
OutlineControllerToggles the sprite outline on the dragged piece using a single static shared material (zero per-frame GC); loads the shader from Resources first with a Shader.Find fallback.
BlockData / ColorDataScriptableObject lookups: block-type → cell footprint + sprite, and ColorType → colour + picture sprite.

Engine Scripts (Jig Sort)

ScriptDescription
LevelManagerStatic loader (HypercasualGameEngine). Reads Assets/Jig Sort/Resources/Levels/*.json (editor: disk; player: Resources.Load), tracks the current level under PlayerPrefs key Jig Sort_CurrentLevel, and exposes GetCurrentLevel, AdvanceLevel, GoToPreviousLevel, LevelCount, ForceReload, plus editor-only disk-write helpers used by the level tools.
SoundManagerSFX singleton (HypercasualGameEngine). One 2D AudioSource, masterVolume, and one Play method per event — including the four NewestDevUI-required methods (PlayBlocked, PlayBoosterShuffle, PlayBoosterBomb, PlayBoosterUnlock).
CameraSwitcherShared camera helper carried over from the engine.

Editor Scripts (Jig Sort)

ScriptDescription
LevelEditorWindowTools/Jig Sort/Level Editor — two-pane level designer.
AutoLevelGeneratorWindowTools/Jig Sort/Auto Level Generator — batch generator with a difficulty curve.
JigSortSetupWizardTools/Jig Sort/Setup Wizard — idempotent scene / audio / settings / post-processing automation.
JigSortWelcomePopupTools/Jig Sort/Welcome — first-open splash linking both wizards + tools.
InputSystemCheckWarns if Active Input Handling is not set to Both.

Shared UI Scripts (NewestDevUI — namespace HypercasualGameEngine)

ScriptDescription
LoseWinPanelManagerWin / Lose panels, the winLevelText label, button re-wire on every show, and Next-Level progression (AdvanceLevel before scene reload).
BoosterManagerThe three booster buttons, level-gated counts (Init(LevelData) reads the three counts), one-time tutorial popups (shown before the can-run gate), and SFX.
DeveloperModeButton / DeveloperSettingsControllerDeveloper-mode panel with Shift+U/W/L/R hotkeys (ad-guarded).

Level Editor

Open it from Tools > Jig Sort > Level Editor. The window is split into two panes:

Levels are written to Assets/Jig Sort/Resources/Levels/Level_N.json on Save All Levels.

Auto Level Generator

Open it from Tools > Jig Sort > Auto Level Generator. It appends new levels starting after the last existing one (never overwrites). Tunables:

Every generated level is solvable by construction: each box gets one colour, the tray is the exact 4-quadrant complement of all boxes, and all boxes are visible at start — there is no luck-based generation and no "force a matching turn" post-process. A red Delete All Levels button (with confirm) clears the folder.

Boosters

Three boosters, level-gated by the per-level counts in LevelData. The buttons, counts, and one-time tutorial popups are provided by the NewestDevUI BoosterManager; the effects are implemented game-side in GameLevel / JigSortGameManager.

BoosterEffectSoundManager method
ShuffleRe-randomises all loose tray pieces — including their top/under stacking, so a hidden under-piece can surface and hide a different one. Pieces animate to their new slots.PlayBoosterShuffle()
Magical FillPicks a random visible box and pulls its proper pieces in one after another along arced curves with fading trails, then completes it.PlayBoosterBomb()
HintFlashes a movable piece and loops a translucent ghost of it gliding to its correct box, with a flashing target ghost left on the destination cell.PlayBoosterUnlock()

The one-time tutorial popup fires on the first click of each booster before any "can this run" gate, so the player always learns what a booster does. Popup state is persisted under PlayerPrefs keys BoosterPopupShown_Shuffle/Bomb/Unlock.

Customization

Change the artwork

Swap the quadrant sprites in the BlockData asset and the per-colour picture sprites in the ColorData asset. The 13-colour ColorType palette can be re-tinted in ColorData without touching code.

Puzzle pictures

Drop your puzzle images (PNG) into Assets/Jig Sort/PuzzleImages/, then run Tools → Jig Sort → Refresh Puzzle Images — it imports them as sprites and builds Resources/PuzzleImageData.asset. The Auto Level Generator then assigns a random picture to each colour in every level (same-colour boxes share a picture); the four quadrants of a box assemble that image. If a level has no picture assigned for a colour, it falls back to the ColorData sprite. Tip: for the four quadrants to tile cleanly, give the images a consistent sprite size / Pixels-Per-Unit in the importer.

Tune difficulty

Use the Auto Level Generator's min/max ranges and difficulty ceiling, or hand-author levels in the Level Editor. Levels 1–5 are hand-tuned as a gentle on-ramp.

Audio

Drop your WAV clips into Assets/Jig Sort/Audio/ (use names containing LevelClear, LevelFail, Blocked, Pickup, Place, Complete, Shuffle, Bomb, Unlock, or the Success*/Fail*/Pop*/Switch* pools) and run the Jig Sort Setup Wizard's "Auto-wire SoundManager clips" step.

Post-processing

The shared HC URP profile lives at Assets/Jig Sort/PostProcessing/HC-PostProcessing-Volume.asset. The Setup Wizard retargets the scene's Global Volume and the URP render-pipeline assets to it at weight 0.8.

Support

This template is part of the HyperCasual Game Engine — Mobile Puzzle Templates Kit. For questions about the shared UI / booster / developer-mode stack, see Assets/Jig Sort/Documentation/NewestDevUI-README.md. For the game-specific systems, the in-line XML comments in each script under Assets/Jig Sort/Scripts/ and Assets/Jig Sort/Editor/ are the source of truth.

Contact

Questions, bug reports, or feature requests? Email ragendom@gmail.com.

Common Issues

SymptomCause / Fix
"No levels found" error on PlayThe Levels folder is empty. Run Tools > Jig Sort > Auto Level Generator to generate levels.
No win/lose panel, no booster buttonsNewestDevUI isn't imported or its Setup Wizard hasn't run. Import it and run Tools > NewestDevUI > Setup Wizard, then re-run the Jig Sort Setup Wizard.
Game is silentNo audio clips in Assets/Jig Sort/Audio/. Import the SFX pack and re-run the Setup Wizard's audio step.
Magenta / pink screenURP is not the active render pipeline. Check Project Settings > Graphics.
Level 2 doesn't load after a winA LevelData lost its HideFlags.HideAndDontSave. The shipped LevelManager sets it; don't remove it.