RogueLibs' logo

Extra Utilities

RLSetup attribute

Since RogueLibs handles custom stuff as classes, you might forget to initialize a new class in your plugin's Awake. That's why RLSetup attribute is here. You can just add it to a static method, and initialize your custom thing in there.

/MyAwesomeProject/MyAwesomeItem.cs
public class MyAwesomeItem : CustomItem{    [RLSetup]    public static void Setup()    {        RogueLibs.CreateCustomItem<MyAwesomeItem>()            .WithName(new CustomNameInfo("My Awesome Item"))            .WithDescription(new CustomNameInfo("My Awesome Item is very cool and does a lot of great stuff, and it's also awesome."))            .WithSprite(Properties.Resources.MyAwesomeItem)            .WithUnlock(new ItemUnlock());                RogueLibs.CreateCustomName("MyAwesomeName", NameTypes.Dialogue, new CustomNameInfo("That's awesome!"));    }}

You'll just have to call the following method in your plugin's Awake:

/MyAwesomeProject/MyAwesomePlugin.cs
    public void Awake()    {        RogueLibs.LoadFromAssembly();        /* ... */    }
Pro-tip

Seriously, you should use it. It helps with versioning too. All of the logic in one place.

IDoUpdate/IDoFixedUpdate/IDoLateUpdate

RogueLibs provides a couple of extra interfaces that you can use for any supported custom content hooks: IDoUpdate, IDoFixedUpdate and IDoLateUpdate. These interfaces correspond to the Update, FixedUpdate and LateUpdate Unity methods (not directly, but through the game's Updater class).

If you want to update your items/traits/effects/objects with Unity's Update, FixedUpdate or LateUpdate, implement these interfaces:

/MyAwesomeProject/MyAwesomeItem.cs
public class MyAwesomeItem : CustomItem, IDoUpdate{    public void Update()    {        /* ... */    }}