square-arrow-upUpgrades System Structure

Upgrades Manager

The UpgradesManager is located in the Main Menu scene hierarchy under the Game Controller GameObject.

It is responsible for:

  • Loading upgrade behaviors during stage initialization

  • Unloading them when returning to the main menu

  • Providing access to all available Upgrade Data

You can access it in code via the property:

GameController.UpgradesManager

All methods of UpgradesManager are declared as virtual. If you wish to modify or extend its functionality, it is recommended to create a new class that inherits from it, rather than editing the original directly.

Upgrades Database

he Upgrades Database is a simple asset that contains a list of Upgrade Data assets. Only the upgrades listed in this database will be available in the game.

You can find the asset at: Assets/The Archer/Scriptables/Upgrades

Upgrade Data

Each upgrade is defined by an Upgrade Data asset that stores all information and values related to that specific upgrade. Unlike abilities, all upgrades share the same Upgrade Data class.

UpgradeData.cs contains the following key fields:

Property
Description

UpgradeType type

An enum value that uniquely identifies the upgrade. There must not be two upgrades with the same type.

Sprite icon

The upgrade's icon, shown on the UI.

string title

The display name of the upgrade. Shown on the UI.

string description

The display description of the uprade. Shown on the UI.

string statsText

The text that will be used inside string.Format function to show how increasing upgrade level will change it's value. For example, here is the statsText value of the Attack Speed Upgrade: "{0}><color=#75F05F>{1}"

float initialValue

This value is shown in statsText whem the upgrade isn't purchased. Usually 0 for values and 1 for multipliers.

GameObject prefab

The prefab that represents this upgrade. Its root object must include an Upgrade Behavior component that defines the upgrade's functionality.

int devStartLevel

If bigger that -1 that at the start of the game the upgrade will be purchased and it's level id will be set to this value. It is used in demo build of the game to unlock Revive Upgrade by default.

You can subscribe to the event onUpgradeLevelChanged to execute custom logic whenever the upgrade’s level is increased.

Upgrade Level

All upgrades use a shared Upgrade Level class, which defines two key fields:

  • Cost - The amount of gold required to unlock or upgrade this level.

  • Value - The upgrade’s numerical value. Each Upgrade Behavior interprets this value differently depending on the type of upgrade.

Upgrade Behavior

Each upgrade must have its own prefab with a component that inherits from the UpgradeBehavior class. This base class provides several commonly overridden methods used to control initialization, level updates, and cleanup.

Commonly Overridden Methods

Called once at the start of the stage when the upgrade is activated.


Called when the upgrade is first activated and whenever its level changes.

circle-info

Note: Under the default template behavior, upgrade levels do not change during gameplay.


Called when the upgrade is removed. By default, this method destroys the upgrade’s GameObject. If you override it, make sure to call base.Clear() at the end to ensure proper cleanup.

Last updated