Tech Tree API

Tech Tree API

Put your own upgrades in the Tech Tree. You describe the node and write the effect; Tech Tree draws it, prices it, gates it, saves it and translates it.

What this is

Tech Tree is an upgrade tree that lives as an app on the store computer in Supermarket Simulator. Since version 1.3.0 it is also a host: any BepInEx mod can register its own upgrade lines and they appear in the tree alongside the built-in ones.

The split is deliberate and it is the whole point of the API:

Your modTech Tree
Names the upgrade and its iconDraws the node, the branch and the connectors
Says how many levels there areChains the levels and enforces buying in order
Says what each level costsCharges the player and handles selling back, 60% by default
Writes the one-line effect textShows it on the hover card in the player's language
Decides when the node unlocksGreys it out and shows your reason until then
Implements the effectSaves the level per save slot and tells you when it changes

You never touch Il2CppInterop to use the API. Nothing in the public surface is a Sprite, a Color or an Il2Cpp* type - it is all plain objects and delegates.

Hello world

This is a complete, working registration. Two calls.

csharp
using BepInEx;
using BepInEx.Unity.IL2CPP;
using TechTree.Api;

[BepInPlugin("BigBoxes", "Big Boxes", "1.0.0")]
[BepInDependency(TechTreeApi.ModGuid)]
public sealed class Plugin : BasePlugin
{
    public override void Load()
    {
        // "Big Boxes" is the label of your own sub-tab inside the Mods tab.
        var tree = TechTreeApi.ForPlugin("BigBoxes", "Big Boxes");

        tree.Register(new UpgradeDefinition
        {
            Id            = "bigboxes.capacity",
            DisplayName   = "Bigger Boxes",
            MaxLevel      = 3,
            BaseCost      = 1500,
            Icon          = UpgradeIcon.Builtin("package"),
            DescribeLevel = lvl => $"+{lvl * 2} items per box",
        });
    }
}

That gives the player a three-level line, priced 1500 / 2700 / 4860, saved per save slot, sellable, and greyed out with a price in red when they cannot afford it. What it does not do is make boxes bigger - that part is yours, and Events is where it goes.

The effect is always yours

Tech Tree stores a number and tells you when it changes. It has no idea what "bigger boxes" means. Every node in the Mods tab works this way, including the ones in the example mod.

What you get for free

What it will not do

Where to next