Complete & Automatic Mobile Level Management Kit
Introduction
Level management kit is a completely automatic level management system, tied in with Unity’s Addressable system (but could be easily change to something else). It’s your simple go-to mobile game kit that gives you everything you need: a structured base to your game, all you need to go is add your gameplay!
With this, easily customize how many levels and sections your game will have, and the UI will automatically be generated to suit your input. From there, you can load and play into any game, and your game stats will be saved, and you can continue playing onto the next level, automatically loading, and saving as you go.
With this system, nothing is hidden inside DLLs, so everything can be edited to suit your game.
Asset available now on the Unity Asset Store.
How To Guide
The way that the system works is that you have your main gameplay scene (Scene_Gameplay) and inside this scene you have all the systems that you might need, and when you want to load a level, this level is instantiated in, configured, used, and then destroyed; ready for the next level to be added.
So how do you swap out the current level template with your levels and gameplay?
Step 1: Configuring Your Levels
LevelObject.cs is a class that is attached to each level object that is spawned in. We need to add and setup our levels so that they use this system.Simply add component to the parent of the level, and then configure all the different settings.
Here there will be slots for the level gem, and the level coins (default 3 coins and 1 gem) and the end game button, which you don’t need to worry about yet! Add the Collectables.cs component to all your collectables, and configure them to what they are, a gem, or a coin. Then drag these into the gem and coin variables. The last variable, startTransform, is there the player will start in the level. Simply create an empty game object within the level object, drag it to where you want the player to start and assign the variable. Make sure that the player object is in the Scene_Gameplay scene and assigned in the GameManager.
From there, the collectables will collect and automatically count themselves.
Step 2: Configuring the Game Rules
If your level finishes from a player colliding into an object (such as a finish line), attach the component FinishLevelObject.cs to your end goal. This imply has a function that calls GameManager.Instance.FinishLevel, and make sure that your player has the tag “Player” and you have a collider set to On Trigger.Step 3: Level Data
If your levels aren’t all prefabs already, turn these into prefabs and put them into a folder in your project. From here, locate the LevelDataScriptableObject called LevelData in Assets/LevelManagement. Here copy the sizes you put in the Level Selector game object (Amount of sections and amount of levels in each section) and then drag the game objects into LevelData. This is where the levels will be loaded from.Step 4: Extras
If you want to change the UI, you can find the prefabs in Assets/LevelManagementKit/UI, other than that, most of the UI can be changed directly in the scene.Package Information and Glossary
Level System
The level selector is the main script for all the level management, in here you can easily customise how many sections there are, and SectionData of the level.- Level Panels Parent: The parent transform of where the parent panel will be placed in the hierarchy
- Section Button Prefab: The section select button prefab
- Level Button Prefab: The level select button prefab
- Section Panel Prefab: The scrolling section prefab that the buttons above are instantiated into
Sections
Section (SectionData) hold the data for indivudla sections. Most of this information is generated but some of it can be assigned, such as:- Size: Size is how many sections you want your game to have
- Section ID: The name of the section (displayed in UI)
- Section Length: How many levels are in this section
UI Manager and the UI System
The UI Manager has some basic UI functionality built into some core methods that are called by different scripts such as the game manager during different fundamental parts of the game (for example, when the game is ending, and the end screen needs to appear). To make this part flashier, you could add some animations into this UI Manager rather than doing what is happening now (just a simple turning the object on and off).UI Stat Shower
UIStatShower is a script that gets a certain stat and shows it with the prefab that it comes with (either the progress display, or the currency display). Inside these you select the drop down as to what display you want to show and make sure it’s being updated along with the 3 bars at the top.UI Coin Gem Tab
The UICoinGemTab is used in a few different places, with the functionality being to show how many coins and gems the user has collected. This is done both at the end of the game, and in the level select UI.Simply drag and drop the prefab in where you need it, and call SetUI(amount of coins, amount of gems) and the UI will show this.
Collectables
Collectable Manager is an easy way for you to change how the collectables sound/look. Simply change the sounds CoinCollect and GemCollect to change how the different collectables sounds.The Collectable script contains some simple functionality for collecting the item, which can be easily changed / added to where needed.
Game Management and Gameplay Functionality
The Game Manager is a Singleton class that holds all of the gameplay functionality from Loading the level, to Starting the level and finishing the level. The GameManager script also contains the class GameManagerHelper will a lot of constant variables that you can change to your liking- Max Moves: How many moves the player can make until they stop receiving a score bonus. This can be linked to your player if you want it to be, if not it can be ignored.
- Timer Points Max: How long the player can take and receive the highest point boost
- Timer Points Middle: How long the player can take and receive the second highest point boost
- Timer Points Least: How long the player can take and receive the lowest point boost
- Timer Points None: How long the player can take and receive no point boost point boost
- Coin Score: Default point score for a coin
- Gem Score: Default point score for a gem
Stats Management
Stat Manager holds the functionality for holding all the basic statistics from the player, and also the levelling system (LevelSystem).Inside the LevelSystem you can change how muchn XP you need to rank up. By default it is 15 levels, incrementing slowly the XP that you need for each level (10 to 3000 xp) and after level 15 it is 3000 XP per level to level up.