The demo scene
Open Assets/SimpleMaze/Scenes/SimpleMazeDemo.unity and press Play. The scene holds a camera, a sun, and one object called Simple Maze Demo with the MazeDemo component and the five level packs assigned. Everything else, from the maze to the menus, is built in code when the scene starts, so there are no prefabs, models, textures or audio files to look after.
The demo reads the keyboard through the Input System package. If nothing happens when you press keys, set Project Settings > Player > Active Input Handling to Input System Package or Both.
One component: MazeDemo
Add MazeDemo to any object in a scene with a camera and press Play. When it starts, it builds:
- a Maze child with MazeView3D, which draws the maze, and MazeGame, which plays it;
- the HUD (MazeHud) and the hub (MazeHub), both in uGUI with Unity's built-in font;
- MazeBeeper for the sounds and MazeEffects for the effects.
It also sets the camera up for the maze, giving it a plain background colour and a 40 degree field of view, and adds a sun if the scene has no light.
| Field | What it does |
|---|---|
Camera | The camera that shows the maze. Empty uses the main camera, and if there is none, one is made. |
UiThroughCamera | Draw the HUD and the hub through the camera instead of over the screen, so the camera's own picture includes them. |
Pitch | How steeply the camera looks down at the maze, in degrees (58 by default). |
HdrpLook | HDRP only: give the demo the same look as on the other pipelines. Turn it off to use your own volumes and lights. |
ClassicPack, GimmicksPack, RollPack, TowerPack,
RacePack | The level pack for each mode. Any can be empty, and that mode's Level Pack tab
then says so. GimmicksPack is the Dungeon mode's pack. |
The flow
Welcome
The first screen says what Simple Maze is and where to make your own mazes, with the publisher's contact at the bottom. Let's play goes on, and About on the mode screen brings it back.
Pick a mode
Five cards, each with a picture of a small maze of that mode drawn without its solution.
Endless or Level Pack
Endless lets you pick a grid and a difficulty from 1 to 5 stars, then builds a new maze to that order on a background thread. Level Pack shows the mode's levels as numbered buttons: grey still to do, the mode's colour solved, and gold solved on par. Play starts the first level you haven't solved. The demo remembers your choices for each mode while it runs.
Play
The HUD shows the maze, its stars, your moves against par, and whose turn it is. A button bar has Undo, Restart, Hint, Solve, Stairs (when you stand on stairs) and Menu.
Win
After a short celebration a panel shows your moves, the par and a rating, with Replay, Menu and Next (or press Enter). In Endless, Next builds a new maze to the same order, and in a pack it goes to the next level, then back to the pack after the last one. Menu or Esc returns to the mode cards at any time.
The five modes
| Mode | Grids | Endless mazes |
|---|---|---|
| Classic | all four | Plain mazes. The board grows with the stars. |
Dungeon (MazeMode.Gimmicks in code) | all four | Keys and doors from 1 star, gems from 2, a switch and traps from 3, a portal pair and one-way sides from 4, and a second switch at 5. |
| Roll | Square and Hex | The player rolls until something stops it. Braid is set so rolling has loops to use. |
| Tower | all four | 2 floors joined by stairs, or 3 floors from 3 stars, from the rim to the centre. |
| Race | all four | Two players take turns heading for one goal from fair starts, and the first one home wins. |
On a circular board, Endless mazes run from the rim to the centre. The recipes are in MazeModes.Endless, and each one goes through MazePresets.Tune and verified generation, so the maze you get rates the stars you picked whenever the board can reach them.
The level packs
The demo ships with 50 levels in five packs in Assets/SimpleMaze/Generated. Each was made by the generator from a fixed seed, and each was played through to par to check it. They are ordinary MazePuzzlePack assets, so you can open them in the inspector, read their analysis, or export them as printable pictures.
| Pack | Levels | What's in it |
|---|---|---|
| Classic | 12 | Every grid, from a 6 by 6 square up to an 18 by 18 square, including a hex star and a circular heart. Rated 1 to 5 stars. |
| Dungeon | 12 | One new idea per level for the first seven (a key, gems, a switch, a portal, one-way sides, traps and weave crossings), then mixes of them, ending with a 14 by 14 maze that has keys, gems, traps, a switch, a portal and one-way sides. |
| Roll | 10 | Square and hex boards from 6 by 6 to 10 by 10, the last one with gems and a portal. |
| Tower | 8 | 2 to 4 floors on every grid, some with a key or gems. |
| Race | 8 | 2 to 4 players on every grid, each race with equal routes for everyone. |
Your own packs: make mazes in the Maze Generator, choose Save > Pack (all), and drag the pack into a slot on the MazeDemo component.
Progress: each level's best number of moves is saved in PlayerPrefs under
SimpleMaze.Demo.Best.<pack name>.<level>, so it stays on that device. Races are not
recorded, and neither is a level the auto-solver helped with. The win panel says "Level complete!", "New best"
or "Your best is" accordingly.
Playing
The keys are listed at the bottom of the screen while you play, and in the Quick Start. A few details:
- Moving: a key moves you toward the side whose direction on screen is closest to it, so the controls feel right from any camera angle and on any grid. Holding a key keeps walking, and a key pressed during a move is kept for the next one.
- Moves count steps, or rolls that moved someone. Bumping a wall, a roll that goes nowhere and a roll onto a trap don't count.
- Undo takes back one move at a time and Restart puts the whole maze back to the start.
- Hint lays a gold arrow toward the next move of a best way on, worked out from where you are.
- Solve (or F) lets the solver play the rest from where you are. Press it again, or F or R, to stop.
- Several players: in a race the turn passes after every step, and the board shows the maze as the player whose turn it is sees it (their keys, doors and gates). When each player has its own goal, Tab or 1 to 4 switches player. On Roll every roll moves everyone.
- The view: the camera frames the board in the space the HUD leaves free. You can turn it, tilt it and zoom, and when zoomed in it follows the player. On a maze with floors it follows the player's floor and hides the floors above.
- The rating on the win panel is 3 pips on par, 2 a little over (up to 2 moves, or a quarter of the par on bigger mazes) and 1 beyond that. Races show who won instead.
Sounds and effects
MazeBeeper makes every sound in code when the demo starts: steps (three variants, so walking doesn't sound robotic), a bump, a roll, the stairs, a key, a gem, the goal opening, a door, a switch with its gates, a portal, spikes, a "no way" buzz, a hint, undo and restart, the win, and a button blip. M mutes it.
MazeEffects adds small effects made of a pool of tiny shapes: sparkles for a key or a gem in its colour, a gold ring when the goal opens, dust at a bump, a purple swirl at both ends of a portal, sparks off spikes, and confetti for the win. Nothing is created or destroyed while you play, and because the effects use the demo's ordinary materials, they look the same in every render pipeline.
Render pipelines
The demo works in URP (recommended), HDRP and the Built-in pipeline without any changes. Its materials use the active pipeline's default lit shader.
HDRP lights in physical units, sets the exposure on its own and takes its ambient light from a sky, so the demo would come out dark and tinted. With HdrpLook on, DemoHdrp adds a global volume with a fixed exposure, no tone mapping or bloom, and a gradient sky in the demo's colours, clears the camera to the demo's background colour, and sets the sun in lux. That code only compiles when the HDRP package is installed.
Using the pieces yourself
The demo components work on their own too. The smallest setup is one MazeGame, which adds its MazeView3D automatically:
using SimpleMaze;
using SimpleMaze.Demo;
var game = new GameObject("Maze").AddComponent<MazeGame>();
game.Begin(maze); // build it and start a game
game.View.FrameCamera(Camera.main, -1); // -1 frames every floor
game.Won += g => Debug.Log($"Solved in {g.Moves}, par {g.Par}");
- Input: MazeGame reads the keyboard itself. For touch or a gamepad,
call
Push(Vector2 screen)with the direction on screen, andUndo(),Restart(),ShowHint(),StartAutoSolve()andTakeStairs(way)for the rest. - The camera is yours unless you turn on
CameraControls. OnlyFollowFloormoves it, on mazes with floors. - Events:
Wonfires once when the game is won,Cuefor every moment worth a sound,Momentfor the same moments with a position and colour for effects, andMessagefor short notes such as "No stairs here". - A HUD: add a MazeHud and set its
Game, or readMoves,Par,SolvedandPlayerinto your own UI. - The look: the colours, materials and shapes are in DemoLook.cs, and
the timing is on MazeGame (
StepTime,RollTime,PortalTime,HopandSolvePause). - Without the 3D view: keep a MazePlay and use MazeRules directly, as in the Quick Start.