The need
In R.E.P.O., a co-op game built with Unity, the player's stamina drains as soon as they sprint or slide. The idea of the mod: make it unlimited, without touching the game's files.
PreparationWhat I built, step by step
- Understanding the game without its source codeAnalyzing the game's assembly (Assembly-CSharp) to find the class that handles the player,
PlayerController, and the stamina-related fields. - Creating the pluginA BepInEx plugin (the mod loader the game uses) that initializes at launch and applies the patches.
- Changing behavior at runtimeWith Harmony, a postfix runs after the player's
UpdateandFixedUpdatemethods: if they are sprinting or sliding, stamina goes back to its maximum. - PublishingPackaging the mod and publishing it on Thunderstore, the game's main modding platform, where it installs in one click with a mod manager.
[HarmonyPatch(typeof(PlayerController))]
class PlayerStaminaPatch
{
[HarmonyPatch("Update")]
[HarmonyPatch("FixedUpdate")]
[HarmonyPostfix]
static void InfiniteStaminaPatch(PlayerController __instance)
{
if (__instance.sprinting || __instance.Sliding)
{
__instance.EnergyCurrent = __instance.EnergyStart;
}
}
}
Technical challenges and solutions
-
Modifying a game without its code
The problem
R.E.P.O.'s source code isn't available, so it can't be modified directly.My solution
Patch the methods at runtime with Harmony. The game's files are never modified and the mod can be uninstalled at any time. -
Changing only what's needed
The problem
An overly broad patch could break other game mechanics.My solution
The patch only acts in two specific situations, sprinting and sliding. Everything else about the player's behavior is unchanged.
The result
Published on February 28, 2025, a few days after the game's early access release, the mod has 384,452 downloads on Thunderstore (as of November 25, 2026).
Next timeWhat I learned
A few dozen lines of code can serve hundreds of thousands of players. This project taught me to read and understand other people's code and to ship for real users.
A possible next step: a BepInEx configuration file to choose a stamina multiplier rather than infinite stamina.
