UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Component Module / Level System Completed

Component Module — UGTK

Level System

Summary

The Level System module provides a set of classes that allow to manage xp and levels for a game character.

Each type of xp management has its own model growth of level from xp.


Content


Modules Dependencies

The Movement Component module requires the following dependencies:

Ensure that these dependencies are correctly imported and configured in your project.

Only in the demo scene. The Debug scene of this module also uses UIModule/SliderSystem, UIModule/TextUpdaterSystem. Nothing in the runtime code needs them: import this module on its own and it works, but the demo scene opens with missing scripts where those components were.


Setup

To set up the Movement Component module, follow these steps:

Choose Level System Type

Choose the type of level system you want to use: - Scaled: The level grows by a factor of the xp. - Find and put in a scene the prefab ScaledLevelComponent or add component Mn_ScaledLevelComponent to a GameObject. - Costant: The level grows by a constant factor. - Find and put in a scene the prefab ConstantLevelComponent or add component Mn_ConstantLevelComponent to a GameObject. - Mapped: The level grows is manually mapped. - Find and put in a scene the prefab MappedLevelComponent or add component Mn_MappedLevelComponent to a GameObject.

How to set up the components starting to what they share in common:

Level system common field

Sure, here is a description of each variable in the Mn_LevelComponent class:

Scaled Level System

The Mn_ScaledLevelComponent class has the following additional variables:

Constant Level System

The Mn_ConstantLevelComponent class has the following additional variables:

Mapped Level System

The Mn_MappedLevelComponent class has the following additional variables:


How To Use

To put in use the Level System module, follow these steps:

Initialization

levelComponent.Init(1, 0);

Gain EXP

levelComponent.GainExp(10);

Lose EXP

levelComponent.LoseExp(10);

Testing Scene:


Testing Scene

Open LevelComponentScene in the module's Debug/ folder. Select the ScaledLevelComponent under one of the three characters: everything happens in the Editor block of its inspector, with the editor stopped.

What to do, in order:

  1. Press Gain EXP a few times and watch Current Exp and Current Level. With the default multiplier of 1.5 each level costs more than the last, so the same reward buys fewer levels as you climb.
  2. Press it enough times to cross several levels at once.
  3. Turn Eliminate Excess Exp On Level Up off and repeat step 2: the leftover experience now carries into the next level instead of being thrown away.
  4. Press Lose EXP with Can Delevel on, then off.
  5. Press Init to put the component back to Init Level and Init EXP.

Steps 2 and 3 change the pacing of a whole session, not a detail: with the excess discarded, a single large reward can never chain two level ups. Step 4 shows the difference between a level that is a floor and one that can be lost.


Technical Info

The following are the main scripts and workflow of the Level System module:

Scripts:


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Depends on 3

Used by 0

  • No other module depends on it.

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 5 modules in total.