A Color-Block Sliding Puzzle — Unity Template
Version 1.0 | Unity 6+ | URP
SlideBlock is designed as a template and starting point for your own game. It ships with the core systems, architecture, and tools needed to build a color-block sliding puzzle — gameplay, a visual level editor, an automatic level generator, a 500-level starter pack, mystery blocks, and three boosters. You are expected to customize, extend, and re-skin it to create your unique game. This is a foundation for developers to build on, not a finished, ready-to-publish product.
SlideBlock is a one-tap color-matching puzzle. Colored blocks queue up on a row of posts at the bottom of the screen (the “shooters”). The player taps a shooter to slide it up into its column; when a block lands against blocks of the same color, the connected group clears. Clear the board before the columns jam to win. The game ships with a difficulty curve that grows the board from 3 to 5 columns and the palette from 3 to 5 colors, gravity-settled level layouts, hidden “mystery” shooters and obstacles, a disco wildcard, three boosters, a visual level editor, an automatic level generator, and 500 ready-made JSON levels.
Tap a shooter on a post and it slides up its column. When it meets a same-colored block, the whole connected group flood-fill clears with a particle burst. Simple to learn, satisfying to chain.
Early levels use 3 columns; the board widens to 4 and then 5 as the player progresses. The grid, tray walls, and posts all re-center automatically to the active column count.
Pink, Yellow, Blue, Green and Purple, plus a disco wildcard that can be cleared by any color and detonates a big chain. The active palette grows from 3 to 5 colors with difficulty.
Mystery shooters spawn with their color hidden under a “?” and only become draggable once the rest of the batch is fired. Mystery obstacles stay hidden and indestructible until gravity drops them to the bottom row — then they reveal with a pop and color transition.
Pre-placed obstacles are generated as if gravity already ran: every column is a contiguous bottom-up stack with no floating gaps. The board reads as a complete, settled tray from the very first frame.
Shuffle Obstacles (the board visibly reshuffles), Disco (explode obstacles and pop disco wildcards in their place), and Rainbow Shooter (turn a shooter into a color-cycling cube that clears any color).
A Unity Editor window for hand-authoring levels: paint colored obstacles (and mystery obstacles) onto the grid, set per-column shooter queues, and tick individual queue blocks as mystery shooters.
Batch-generate levels with a built-in difficulty curve: column count, palette size, queue length, stack height, wildcard density and mystery frequency all scale with the level number. Append-only and one-click clearable.
500 levels ship as plain JSON under Resources/Levels/. Regenerate or extend any time with the Auto Level Generator.
Active Input Handling to Both (Project Settings > Player)Edit > Project Settings > Graphics).Assets/SlideBlock/Scenes/GameNew.unity.Tools > SlideBlock > Level Editor or Tools > SlideBlock > Auto Level Generator.In Play mode, tap the front block on any post. It slides up its column and snaps to the landing row. If it touches a connected group of its own color, that group clears and the blocks above settle down under gravity. Clear the board to advance; the next level loads automatically. If a column fills with no possible match, the lose panel appears.
Everything ships under a single root folder, Assets/SlideBlock/, for clean import and removal.
The board has a row of posts (3–5, depending on the level). Each post holds a queue of colored blocks; the front one is the active shooter. Tapping a shooter slides it up into its column toward the landing row. When the shooter meets a connected group of its own color, a flood-fill clear removes the whole group with a particle burst, and the blocks above settle down under gravity to fill the gaps. Posts keep refilling with fresh shooters, so you never run out of ammo — the level is a race to clear N cubes before a column jams.
InputManager raycasts the tapped block; if it is the active, tappable shooter it slides up its column to the landing row.GameLevel.GetBlockMapping walks the connected same-color neighbours from the landing cell; two or more clears them, otherwise the shooter stays.clearTarget) number of cubes. The target scales with the level, so the first levels clear fast and later ones need progressively more. Every destroyed cube counts toward it — a normal match adds its group size and a disco adds the whole chain it detonates. A progress bar + count at the top of the screen shows cubes cleared vs the target. Lose — a column jams with no available match.Five real colors plus the disco wildcard, defined in TypeColor (LevelData.cs) and mapped to materials in ColorData.asset. The active palette grows from 3 to 5 colors with difficulty (the wildcard is in addition).
| TypeColor | Color | Approx. RGB |
|---|---|---|
Pink | Pink | (1.00, 0.33, 0.81) |
Yellow | Yellow | (1.00, 0.88, 0.30) |
Blue | Blue | (0.20, 0.47, 0.95) |
Green | Green | (0.30, 0.79, 0.35) |
Purple | Purple | (0.61, 0.35, 0.89) |
Color | Disco wildcard | sprite-rendered (no fixed color) |
Note: Color is the wildcard and must always remain the last entry of the enum — code uses (int)TypeColor.Color as the count of real colors. Every real color a level uses needs a material entry in ColorData.
A disco block (TypeColor.Color, rendered via its sprite) sits in the grid like any obstacle but can be cleared by a shooter of any color. When a shooter lands against a disco at the foot of its column, ClearAllBlockMappingTypeColor shakes and detonates every block of the shooter's color plus every disco on the board — one move can clear a large part of the grid. The cascade plays a layered burst of pop SFX so the size of the clear is audible.
Mystery blocks hide their color behind a grey tint and a floating “?” label, and reveal with a pop + grey→color transition. They come in two flavours, both authorable in the editor and generated on a difficulty curve (rare on early levels).
y = 0).Both use a reveal animation driven by a MaterialPropertyBlock color lerp and an ease-out-back scale pop. An optional mysteryMaterial on GameLevel overrides the default grey look.
Runtime scripts use the SlideBlock / SlideBlock.Scripts namespaces. Editor tools use SlideBlock.EditorTools. Shared engine helpers (SoundManager, LevelManager, BoosterManager, LoseWinPanelManager) live under HypercasualGameEngine.
| Script | Description |
|---|---|
GameLevel.cs | The heart of the game: builds the board from LevelData, spawns shooters and obstacles, handles tap-to-fire, flood-fill matching, gravity refill, the disco cascade, mystery reveal, the adaptive tray walls, and the booster effects. |
Block.cs | A single block: typeColor, mesh/sprite renderers, CanTap, isMystery, isRainbow, and a hide-above-Z visibility mask for blocks spawned above the tray. |
LevelData.cs | The level model (grid size, colorCount, per-column queues with mystery flags, pre-placed grid obstacles with mystery flags, booster counts) and the TypeColor enum. |
ColorData.cs | ScriptableObject mapping each TypeColor to a material. |
InputManager.cs | Touch / mouse drag handling; routes taps on locked mystery shooters to the wiggle feedback. |
LevelManager.cs | Static JSON level loader and progression (current index, advance, reload). Loads from Resources/Levels/. |
SlideBlockGameManager.cs | Scene orchestrator: win/lose routing and the three booster entry points. |
SoundManager.cs | SFX one-shots plus random variant pools (pops, success, fail, switch). |
| Script | Description |
|---|---|
LevelEditorWindow.cs | Tools > SlideBlock > Level Editor — paint colored / mystery obstacles, edit per-column queues, tick mystery shooters. |
LevelGeneratorWindow.cs | Tools > SlideBlock > Auto Level Generator — batch generation with the full difficulty curve. |
SlideBlockWelcomePopup.cs | Tools > SlideBlock > Welcome — welcome / review popup. |
Open with Tools > SlideBlock > Level Editor. The editor lists every Level_*.json and lets you author them visually:
Clear Target, per-level booster counts, unlock levels, and grid dimensions.Changes are written straight back to the JSON. Keep the column count within the number of posts in the scene (see Customization).
Open with Tools > SlideBlock > Auto Level Generator. It batch-creates levels with a built-in difficulty curve keyed off the absolute level number, so progression stays consistent in append mode. Everything below scales with the level:
clearTarget) — cubes to destroy to win; ramps from ~8 on level 1 to ~60 by level 30, so early levels are quick.Generation is append-only by default (never overwrites earlier levels); a danger-zone button deletes every Level_*.json in one click. The 500 starter levels were produced with this generator.
Three boosters are wired to the HUD booster row (NewestDevUI → BoosterManager → SlideBlockGameManager). Each carries a per-level charge count and unlocks at a configurable level.
| Booster | Effect |
|---|---|
| Shuffle Obstacles | Physically rearranges the visible obstacles — blocks keep their color and animate (with a hop) to a shuffled set of the same cells, so the board stays gravity-settled. |
| Disco | Explodes a fraction of the visible obstacles with colored particles, then pops a disco wildcard into each spot — primed for a big any-color chain. |
| Rainbow Shooter | Turns one active shooter into a color-cycling rainbow cube. It is draggable immediately and, when fired, adopts the color of whatever it lands against — so it clears any color. |
Booster counts and unlock levels are read from each level's data. In a development build you can refill / unlock everything for testing via the developer settings panel.
To add or recolor blocks, edit the materials under Materials/Color/ and the ColorData.asset mapping (one entry per TypeColor). If you add a new color to the TypeColor enum, keep Color (the wildcard) as the last entry, and bump the generator's color ramp.
The ramps live as small, readable helpers at the top of LevelGeneratorWindow.cs (ColumnsForLevel, ColorsForLevel, the mystery-chance helpers) and as the per-level cases in MakeLevel. Adjust them and re-generate. The mystery chances and ramp length are also exposed as fields in the generator window.
The number of playable columns is capped by the number of posts wired into GameLevel.columnParents in GameNew.unity. To support 5-column levels the scene must carry 5 posts; GameLevel re-centers and hides the active posts per level. The tray walls (w-left / w-right / w-up) auto-fit to the active column count.
Booster effects live on SlideBlockGameManager / GameLevel; rewire the three buttons in BoosterManager to taste. Assign SFX clips on the SoundManager component — in particular populate popClips so the disco cascade is audible.
SlideBlock is a developer template. Before reaching out, please review this documentation and the inline comments in the scripts — the gameplay, generator, and booster systems are all commented.
Support & contact: ragendom@gmail.com
Questions, bug reports and feature requests are welcome — please include your Unity version and the steps to reproduce.
Active Input Handling is set to Both and URP is the active render pipeline.Assets/SlideBlock/Scenes/GameNew.unity.TypeColor the level uses has a material entry in ColorData.This asset was built with the HyperCasual Game Engine — check it out for more mobile puzzle templates and shared systems.