UpgradeLib is a small library that handles the registration and unloading of upgrades for your project.
Download the .dll:
.dll file from Thunderstore and move it to the current working directory of your plugin.Link the .dll in your csproj:
<ItemGroup>
<Reference Include="UpgradeLib.dll">
<HintPath>UpgradeLib.dll</HintPath>
</Reference>
</ItemGroup>
Awake method:UpgradeLibManager.Init("com.yourname.yourmod");
var myUpgrade = new UpgradeDefinition(
id: 10001,
internalName: "MY_UNIQUE_UPGRADE",
title: "Example Upgrade",
description: "Does something special when purchased.",
price: 500,
stackable: false,
onPurchased: (fromSave) =>
{
// Code to run when the player unlocks or loads this upgrade
},
onLockedAllUpgrades: () =>
{
// Code to handle logic when all upgrades are locked (e.g., on game over)
}
);
UpgradeLibManager.RegisterUpgrade(myUpgrade);
If any issues occur, feel free to DM me on Discord: rammmmy.