A Snake Puzzle Game — Unity Template
Version 1.0 | Unity 6+
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 snake 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.
Snake Out is a grid-based puzzle game where players drag color-coded snakes into their matching holes before time runs out. The game features procedurally rendered visuals, a built-in level editor, an automatic level generator, a booster system, and full AdMob ad integration.
Intuitive touch/mouse controls — drag snake heads or tails to navigate them across the grid and into matching colored holes.
Full Unity Editor window for designing levels with visual grid painting — place walls, holes, and snake segments with color-coded tools.
Batch-generate hundreds of solvable levels with configurable difficulty curves, grid sizes, snake counts, and obstacle densities.
Three in-game boosters — Freeze Time, Break Wall, and Auto-Solve — with tutorial popups and usage tracking.
Ragendom Monetization module with banner, interstitial, and rewarded video ads. Includes a Dummy provider for editor testing.
Ships with 500 pre-generated levels with a progressive difficulty curve, ready to play out of the box.
Assets/Snake Out/Scenes/GameNew.unityOnce in Play mode, drag any snake by its head (or tail, if unlocked) toward the hole that matches its color. When all snakes are in their holes, the level is cleared and the next level loads automatically.
Each level is a grid containing color-coded snakes, holes, and walls. The goal is to guide every snake into the hole that matches its color before the countdown timer reaches zero.
The game supports seven predefined snake/hole colors:
| Color Key | Color | Hex Value |
|---|---|---|
orange |
Orange | #FFA502 |
pink |
Pink | #FF6B81 |
darkblue |
Dark Blue | #1E90FF |
blue |
Light Blue | #48DBFB |
red |
Red | #FF4757 |
yellow |
Yellow | #ECCC68 |
green |
Green | #7BED9F |
When a snake reaches its matching hole, it enters a segment-by-segment sucking animation. Each segment is removed on a timer while the visuals smoothly slide toward the hole. Colored particle bursts spawn at the hole entrance as segments are consumed.
Runtime scripts use the HypercasualGameEngine namespace. Developer/UI scripts use the PixelShooter3D namespace.
| Script | Description |
|---|---|
SlitherRushGame |
Main game controller. Spawns the grid, walls, holes, and snakes procedurally. Handles input (drag-to-move), game timer, hole entrance detection, win/lose conditions, and all booster logic. Attached to the root game object in the scene. |
SlitherSnake |
Individual snake entity. Manages segment data, line renderer visuals (with shadow), eye animation, tongue animation, tail indicator, drag preview, hole slide animation, hole burst particles, and auto-solve flight arc. |
LevelData |
Data structures for levels: GridPos, LevelHole, LevelSnake, LevelData, and the SlitherColors color palette. Serializable to/from JSON. |
LevelManager |
Static class that loads level JSONs from Resources/Levels/, tracks the current level index via PlayerPrefs, and provides methods to advance, go back, or jump to any level. |
SoundManager |
Singleton audio system. Exposes named methods for each sound effect: PlaySnakeMove(), PlaySnakeFlyToHole(), PlaySegmentSucked(), PlayFreezeTime(), PlayBreakWall(), PlayGameWin(), PlayGameOver(). |
LoseWinPanelManager |
Manages the Win and Lose UI panels. Auto-finds child panels by name. Supports auto-loading the next level after a configurable delay on win. |
| Script | Description |
|---|---|
CameraSwitcher |
Switches the camera between multiple parent transforms (for multi-game setups). Persists the selected index via PlayerPrefs. |
InfiniteRotator |
Simple component that continuously rotates its transform around the local Z axis. Used for UI effects like radial shine animations. |
DeveloperModeButton |
Toggles a developer settings panel on click. Auto-finds a child named DeveloperSettingsPanel if no reference is assigned. |
DeveloperSettingsController |
Developer panel with buttons for level navigation (next, previous, reload, trigger win/lose) and ad testing (show/hide banner, show/request interstitial, show/request rewarded). |
| Script | Description |
|---|---|
LevelEditorWindow |
Unity Editor window (Tools > Snake Out Level Editor) for visually designing levels with a grid painter. |
LevelGenerator |
Unity Editor window (Tools > Snake Out Auto Level Generator) for batch-generating levels with configurable parameters. |
In the Unity menu bar, go to Tools > Snake Out Level Editor. This opens a dedicated Editor window — no need to enter Play mode.
| Mode | Left Click |
|---|---|
| None | No painting — click cells to inspect |
| Wall | Place a wall obstacle at the clicked cell |
| Hole | Place a hole with the selected color at the clicked cell |
| Snake | Append a segment to the selected snake at the clicked cell |
| Erase | Remove whatever is at the clicked cell (wall, hole, or snake segment) |
All levels are stored as individual JSON files in Assets/Resources/Levels/ with the naming convention Level_1.json, Level_2.json, etc. They are loaded at runtime via Resources.LoadAll.
The Automatic Level Generator is an Editor tool that batch-generates solvable puzzle levels procedurally. It uses constraint-based random placement with configurable difficulty curves.
In the Unity menu bar, go to Tools > Snake Out Auto Level Generator. This opens a settings window where you can configure all parameters before generating.
| Setting | Description |
|---|---|
| Levels to Generate | How many new level files to create. New levels are appended after existing ones (never overwrites). |
| Cols / Rows (Min & Max) | Range for randomizing the grid dimensions of each level. |
| Snake Count (Min & Max) | Range for the number of snakes placed per level. |
| Snake Length (Min & Max) | Range for the segment count of each snake. |
| Empty Tiles % (easy → hard) | How much of the grid remains open. Higher values = easier (more room). Interpolates from easy to hard across the batch. |
| Time Limit (easy → hard) | Countdown timer in seconds. Interpolates across the batch. |
| Tail-Lock Chance (easy → hard) | Probability that a snake's tail is locked (can only move by head). Higher values = harder. |
| Hole Distance Factor (easy → hard) | Controls how far holes are placed from their matching snakes. Higher values = harder. |
| Max Floating Wall Islands | Maximum number of disconnected wall clusters per level (0–5). |
Resources/Levels/The generator never overwrites existing level files. It always starts numbering from the next available index (e.g., if Level_500 exists, new levels start from Level_501).
The game includes three booster abilities that players can activate during gameplay. Each booster has a limited number of uses per level and an optional tutorial popup that appears on first use.
| Booster | Effect | Activation |
|---|---|---|
| Freeze Time | Pauses the countdown timer for a set duration, giving extra time to solve the puzzle. | Tap the freeze button. The timer bar changes color to indicate the freeze is active. |
| Break Wall | Destroys a single wall obstacle, opening up a new path. Spawns a debris particle explosion. | Tap the wall-destroy button, then tap any wall on the grid to break it. |
| Auto-Solve (Wing) | Automatically flies a selected snake into its matching hole with an arc animation. | Tap the wing button, then tap any snake on the grid to auto-solve it. |
Booster buttons are found in the scene UI. Each button has:
Press the U key during gameplay to unlock all boosters (removes lock state). This is useful for testing.
This project includes a Ragendom Monetization module for integrating AdMob ads (banners, interstitials, and rewarded videos). The ad system supports both real AdMob ads on device and a built-in Dummy ad provider for testing in the Unity Editor.
Full setup and configuration instructions for the ad system are provided in a separate documentation file located at:
That documentation covers AdMob app IDs, ad unit IDs, UMP/GDPR consent, test devices, and all monetization settings.
If you prefer a video walkthrough over reading documentation, watch the full ads setup tutorial here:
▶ Watch Ads Setup Tutorial on YouTube
The ad system consists of the following key components in the scene:
MonetizationInitModule component. It initializes the ad system on Awake using the assigned MonetizationSettings asset.Assets/Snake Out/RagendomAds/Modules/Monetization/MonetizationSettings.asset. Contains all ad provider configuration, timing, and consent settings.Dummy provider for editor testing.| Ad Type | Description |
|---|---|
| Banner | A small ad strip displayed at the top or bottom of the screen. Show and hide at any time. |
| Interstitial | A full-screen ad. Must be requested (loaded) first, then shown when ready. Supports cooldown timers and conditions. |
| Rewarded Video | A full-screen video ad that grants a reward on completion. Must be requested first, then shown. Always available regardless of no-ads purchases. |
By default, the ad system uses the Dummy provider, which displays test UI overlays in the Editor (a green "TEST BANNER" bar, dark "TEST INTERSTITIAL" overlay, and blue "TEST REWARDED VIDEO" overlay). This lets you verify the ad flow without needing a real device or AdMob account.
The Developer Settings Panel (accessible via the gear icon in-game) includes ad control buttons for testing: Show/Hide Banner, Show/Request Interstitial, and Show/Request Rewarded Video.
Open LevelData.cs and add entries to the SlitherColors dictionary:
New colors are automatically available in the Level Editor and Auto Level Generator.
The grid, walls, holes, and snakes are all rendered procedurally in SlitherRushGame.cs. Key constants:
CELL_SIZE — Size of each grid cell in world units (default: 0.3375)SpawnGrid()Resources/SnakeWallAndGroundSnake rendering is handled in SlitherSnake.cs using Unity LineRenderer components. You can customize:
widthMultiplier on the line rendererCreateEyes()CreateTongue()CreateShadow()New boosters can be added by following the existing pattern in SlitherRushGame.cs:
CreateBoosterButtons()Update() or a dedicated methodHandleInput() if the booster requires a target selectionEach level is a JSON file with the following structure:
The first segment in a snake's segments array is the head; the last is the tail. Grid coordinates are zero-indexed, with (0,0) at the top-left corner.
| Issue | Solution |
|---|---|
| No levels load / "No level data found" error | Ensure JSON level files exist in Assets/Resources/Levels/ with the naming convention Level_1.json, Level_2.json, etc. |
| Purple/missing materials on WebGL | The game uses Sprites/Default shader for runtime-created transparent materials. If you add custom shaders, ensure they are referenced by a material asset in the project so they are included in WebGL builds. |
| Snakes won't enter holes on WebGL | This is caused by shader stripping (see above). The fix ensures CheckHoleEntrance is called before FlashTile so a shader error cannot block game logic. |
| Dev panel buttons don't respond | If you added a Canvas component to the panel (e.g., for sorting order), you must also add a GraphicRaycaster component to the same object. |
| Level Editor shows empty grid | Click "Reload from Disk" in the Level Editor, or ensure the Resources/Levels/ folder exists. |
Resources/Levels/ folder regularlyIf you get stuck or have any issues, feel free to reach out to us at ragendom@gmail.com. We are happy to help!