How to Create a Level Screen: Step-by-Step Guide
In this article
Creating a level screen means building the menu or selection interface that appears before gameplay starts, letting players pick a stage, see progress, and jump into the action. You can build one in any game engine or even with plain HTML and JavaScript; the core steps are the same: define the data for each level, lay out the buttons or tiles, connect them to your game scene, and handle locked or completed states. This guide uses a generic approach that works in Unity, Godot, GameMaker, or a web-based project, with notes where the tools differ. If you are using a specific engine, the exact menu labels may vary by version, so treat the named paths as a guide rather than a strict script.
What You'll Need
- A game project with at least one playable level scene or file.
- A way to store level data (an array, a JSON file, or a scriptable object depending on your engine).
- Basic UI elements: buttons or clickable tiles, a text label for level numbers, and optional lock/star icons.
- A method to save progress between sessions (PlayerPrefs in Unity, a config file in Godot, localStorage in a browser).
- A scene or screen manager to switch between the level screen and the gameplay scene.
Step-by-Step
- Define your level data. Create a simple list that holds one entry per level. Each entry needs at least an ID or number, a scene name or file path, and an unlocked flag. For example, in JavaScript you might use an array of objects like
{ id: 1, scene: 'Level1', unlocked: true }. In Unity, a ScriptableObject or a simple C# array works; in Godot, an array of dictionaries or a custom Resource. Keep this data separate from the UI so you can change level order without redesigning the screen. - Create a new scene or screen for the level select. In Unity, use File > New Scene and save it as LevelSelect. In Godot, create a new scene with a Control node as the root. In a web project, make a new HTML page or a hidden div. This screen should be separate from your gameplay scene so you can load it quickly and return to it after a level ends.
- Build the layout. Add a grid or horizontal list container. For a small number of levels, a row of buttons works; for many, use a scrollable grid. Place a title label at the top (for example, "Select Level") and a back button. In Unity's UI system, use a Grid Layout Group inside a Scroll View. In Godot, use a GridContainer inside a ScrollContainer. In HTML, use CSS Grid with
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)). - Create a reusable level button prefab or template. Design one button that shows the level number, a lock icon when locked, and a star or checkmark when completed. In Unity, make a prefab from a Button with a Text child. In Godot, save a scene with a Button and Label. In HTML, write a template string or a
<template>element. This keeps every level looking consistent and makes it easy to add levels later. - Populate the screen from your data. Write a loop that goes through your level list and instantiates one button per entry. Set the button's label to the level number. If the entry is locked, disable the button (set
interactable = falsein Unity,disabled = truein Godot, or add thedisabledattribute in HTML) and show the lock icon. If it is unlocked, leave it clickable. Attach the level's scene name or ID to the button so the click handler knows which level to load. - Wire up the click behavior. When a player clicks an unlocked level button, load the corresponding gameplay scene. In Unity, call
SceneManager.LoadScene(sceneName). In Godot, useget_tree().change_scene_to_file(path). In a web project, hide the level screen and show the game canvas, or navigate to the level's page. Make sure the back button on the gameplay screen returns to the level select, not to the main menu, unless that is your design. - Save and load progress. After a level is completed, mark it as completed and unlock the next one in your saved data. In Unity, use
PlayerPrefs.SetInt("Level" + id + "Unlocked", 1)and callPlayerPrefs.Save(). In Godot, write to a config file withConfigFile. In a browser, uselocalStorage.setItem('levelProgress', JSON.stringify(data)). On startup, read this saved data and apply it when building the level buttons. Always guard against missing or corrupted save data by falling back to level 1 unlocked. - Add visual feedback for states. Use different colors or icons for locked, unlocked, and completed levels. For example, locked buttons are gray with a padlock, unlocked are bright, and completed show a star. This helps players understand progress at a glance. Keep contrast high enough to read on small screens.
- Test the full flow. Start from a fresh save, confirm only level 1 is unlocked. Complete level 1, return to the level screen, and check that level 2 is now unlocked and level 1 shows as completed. Try clicking a locked level and confirm nothing happens. Close and reopen the game to verify progress persists. Test on the smallest screen size you support to make sure buttons are still tappable.
Common Mistakes
- Hardcoding level buttons instead of generating them. This makes adding or reordering levels painful and error-prone. Always drive the UI from data.
- Forgetting to disable locked buttons. A locked button that still loads the scene breaks the progression system. Disable the interactable property, not just the visual.
- Saving progress only in memory. If the game closes, progress is lost. Write to persistent storage after every completion.
- Not handling the back button. Players expect to return to the level screen from gameplay. If the back button goes to the main menu, add a separate path or change the behavior.
- Ignoring safe areas on mobile. Buttons near the notch or rounded corners can be hard to tap. Use safe area insets or padding.
Tips
- Keep the level screen lightweight. Avoid loading heavy assets there; load them when the level starts.
- Use a consistent naming convention for scenes (Level01, Level02) so your data file is easy to read.
- Add a subtle animation when a new level unlocks to draw attention without being distracting.
- If you have many levels, group them into worlds or chapters with separate tabs or pages.
- Test with a save file that has every level completed to make sure the screen still looks correct and no buttons are accidentally disabled.
Troubleshooting
If the level screen appears empty, check that your data list is populated before the UI builds. A common cause is building the UI in Start before the data is loaded from disk; load data first, then build. If buttons are visible but clicking does nothing, confirm the click handler is attached and that the button is not set to non-interactable. In Unity, check that the Button component's OnClick list has the correct method and that the method is public. If progress does not persist, verify you are calling the save function and that the key names match between save and load. If the wrong level loads, log the scene name or ID passed to the load function and compare it with your data. If the screen looks broken on different resolutions, set your UI canvas to scale with screen size and test at 16:9 and 4:3. For web projects, check the browser console for JavaScript errors; a single missing element ID can stop the whole script.
Frequently Asked Questions
Do I need a separate scene for the level screen?
It is not strictly required, but it is the cleanest approach. A separate scene keeps the level select logic isolated and makes it easy to return to after gameplay. You can also use a panel that you show and hide within the same scene, which is common in simple web games.
How do I add more levels later?
Add a new entry to your level data list with the next ID and scene name, and make sure the scene file exists. The level screen will generate the button automatically if your loop is set up correctly. No UI changes are needed.
Can I use the same level screen for different game modes?
Yes. Pass a mode parameter to your level screen and filter the data list by mode. For example, each level entry can have a mode field, and the screen only shows entries matching the selected mode. This avoids duplicating the entire screen.
Why does my level screen show all levels unlocked?
Your unlock check is probably not reading the saved data, or the default state is set to unlocked. Check that you initialize new levels as locked except the first, and that you apply saved progress after loading. Also confirm the save key matches exactly.
How do I reset progress for testing?
Add a hidden developer button or a keyboard shortcut that clears the save data and rebuilds the screen. In Unity, call PlayerPrefs.DeleteAll(); in a browser, call localStorage.removeItem('levelProgress'). Remove or disable this before release.
Is it better to use buttons or a scrollable list?
For up to about 20 levels, a grid of buttons is fine. Beyond that, a scrollable list or paginated worlds keeps the screen usable. The choice depends on your level count and screen size; test with the maximum number you plan to support.