Runner games are some of the most popular on mobile devices. This is due to the low entry threshold for gamers, quick gameplay sessions, and the use of viral trends. With Unity’s new template for runner games, developers can iterate and prototype faster, allowing more time to devote to game creation.
Guide to Using the Template
After downloading the free template in the Unity Hub, users receive an editor’s guide, which walks them through the template’s components, how to create and modify levels with the built-in level editor, and how to set up the Ads service for the project.
To save time, the template provides fully functional through-game mechanics and «grey box» assets as a starting point for development.
Users then add their themes, textures and assets via the Unity Asset Store. For example, the user focuses on the runway geometry, adding obstacles, gates, and objects such as coins and keys.
The template contains customizable levels that showcase different game designs. Customization features include:
- Autosave. Changes to the level, player prefab or camera prefab are automatically saved when you enter game mode;
- Terrain. Ability to specify the length, width, start buff, end buff, thickness, and terrain material, which is automatically regenerated when any of these fields are edited;
- Snapping. Snapping allows you to snap objects to the nearest grid position;
- Prefabs. Specify the prefab to be placed at the level’s beginning and end.
Camera and player prefabs
The difference between whether the game becomes a hit or not is very small. That’s why camera angle, colours, and speed play a significant role. The Runner template has options to experiment with and find what works best for the game.
- Camera angle presets. Easily choose between frequently used camera positions. Users can also lock the camera position, enable smooth tracking and more;
- Player speed settings. Choose slow, medium, fast or custom speed. Other options include automatic forward motion, acceleration speed, horizontal speed, and zoom speed.
For objects placed in the scene, the Spawnable class provides logic for serializing and deserializing transformation and colour information and links to the level grid. Such objects include:
- Gates affect the scale or speed of the player.
The classes that form the basis of the game include:
- An event system that facilitates interaction between different parts of the game;
- A state machine that manages the flow of the game, loading and unloading levels, and navigating states such as win, lose, pause, etc.;
- A simple inventory system that keeps track of currencies such as gold and XP;
- A save system that saves game progress;
- A user interface system that displays user interfaces for the current state of the game.
UI windows system
This template presents a complete user interface for a game in the runner genre.
For example, when players complete a level, they see a celebration screen. This stage contains rewards based on performance and gold and XP earned. XP is displayed as a progress bar that shows how far the player is from reaching the next stage.
An enabled level selection screen allows gamers to replay unlocked levels. They are pressing Quick Play loads the highest unlocked level.
There are two types of currency in the game: gold and XP.
- Players collect gold throughout a level. If a gamer does not complete a level successfully, the amount of gold collected in that level will not be added to the total;
- XP gamers earn as they complete a level. The process is similar to currency. The amount of XP a player makes for a level is added to the total amount of XP regardless of whether the gamer wins or loses.
Unity Ads package
Unity Ads are built to help monetize the game. If a user is creating a mobile game that will generate revenue, the Runner game template is a great place to start and an excellent way to learn how to use the Unity Ads SDK.