Skip to main content
The project's repository is archived as part of the GitHub Archive Program. RogueLibs' code and the documentation will no longer be updated.

Custom Unlocks

Custom unlocks allow your custom content to be accessed through vanilla menus. Unlike other hooks, unlocks persist throughout the game, and get destroyed and created only when initially loading the game or changing save slots. RogueLibs also creates wrappers around vanilla unlocks, to ensure the compatibility of your unlocks with the vanilla ones.

UnlockWrapper is a flexible wrapper around a Unlock class, and provides methods to get the unlock's name, description, image and other stuff. It is the base class for any and all custom or vanilla unlocks.

DisplayedUnlock derives from the UnlockWrapper class. It provides methods to display the unlock in the in-game menus. You can alter or augment your unlock's name and description, and even use Unity's rich text formatting. Note, that all rich text formatting tags have to be closed (this was introduced in one of the Unity versions).

caution

You probably shouldn't implement UnlockWrapper or DisplayedUnlock directly. Use the classes described below.

Unlock classes

RogueLibs provides the following classes that you can derive from:

  • ItemUnlock - for items;
  • AbilityUnlock - for abilities;
  • TraitUnlock - for traits;
  • MutatorUnlock - for mutators;
  • AgentUnlock - for agents;
  • BigQuestUnlock - for agent Big Quests;
  • ExtraUnlock - for achievements and other stuff;
  • FloorUnlock - for floor unlocks;
note

There's also a couple of classes that are in RogueLibs only for compatibility reasons.

Initialization

You can initialize your unlocks like this:

MyCustomItem.cs
public class MyCustomItem : CustomItem
{
[RLSetup]
public static void Setup()
{
RogueLibs.CreateCustomItem<MyCustomItem>()
.WithName(new CustomNameInfo("My Custom Item"))
.WithDescription(new CustomNameInfo("My Custom Item is very cool and does a lot of great stuff"))
.WithSprite(Properties.Resources.MyCustomItem)
.WithUnlock(new ItemUnlock
{
UnlockCost = 10,
CharacterCreationCost = 5,
LoadoutCost = 4,
});
}
}

Or you can just initialize them directly (like in case of mutators):

RogueLibs.CreateCustomUnlock(new MutatorUnlock("MyMutator"))
.WithName(new CustomNameInfo("Mutator Name"))
.WithDescription(new CustomNameInfo("Mutator Description"));
The project's repository is archived as part of the GitHub Archive Program. RogueLibs' code and the documentation will no longer be updated.