Skip to content

Mod Call Support

emyhrberg edited this page Jun 11, 2025 · 1 revision

Mod Call

If you want to add more tools to Mod Reloader, you've come to the right place.

Mod Reloader provides support for Mod.Call, see the wiki for more info.

Preview

image

Usage

AddButton

The following call will add a button with an action to Mod Reloader.

"AddButton", string buttonName, Action buttonClickedAction, Asset<Texture2D> buttonTexture, string tooltip

Example

See the following class for an example integration. Change with your own name and actions for the button as desired.

using System;

[JITWhenModsEnabled("ModReloader")]
public class ExampleModReloaderButtonIntegration : ModPlayer
{
    public override void OnEnterWorld()
    {
        if (ModLoader.TryGetMod("ModReloader", out Mod MR))
        {
            MR.Call(
                "AddButton",
                "UIEditor", // your name
                () => Main.NewText("UIEditor"), // your action
                Assets.DragonLensToolIcon, // asset (the preview image has none provided)
                "Edit UI layout" // your tooltip
            );
        }
    }
}

Clone this wiki locally