Skip to content

BoneMenu

adamdev edited this page Dec 24, 2025 · 7 revisions

BoneMenu allows developers to set up a basic menu for their mods, which allows them to configure user-specific settings or make things happen.

Pages

Creation

In order to have your mod be tweak-able from the menu, you must make a page. Pages in BoneMenu are collections of elements, and can be configured with a name and color. To get started, simply call CreatePage on the Page.Root object.

Page myPage = Page.Root.CreatePage("My Page", Color.white);

Indexing

Pages can also be indexed, which means that you can turn to other pages like a book by going either left or right. Simply add a capacity and you're done!

Page myPage = Page.Root.CreatePage("My Page", Color.white, maxElements: 8);

The above code will create a page with max capacity of 8. This means that if you add a 9th element to the page, a new one will be added as an indexed page, and the element will be added to the next page.

Logos

Pages can use a custom logo defined from an asset bundle.

To learn about how to load assets from bundles with BoneLib, see this page.

Texture2D logo = MyMod.Assets.Logo;
Page myPage = Page.Root.CreatePage("My Page", Color.white);
myPage.Logo = logo;

Backgrounds

Likewise with the logos, pages can also use custom background textures loaded from an asset bundle.

To learn about how to load assets from bundles with BoneLib, see this page.

Texture2D background = MyMod.Assets.Background;
Page myPage = Page.Root.CreatePage("My Page", Color.white);
myPage.Background = background;

Function Elements

Function elements are buttons that call your code when someone presses them.

myPage.CreateFunction("My Function", Color.white, () => { Main.Logger.Log("Hello from My Function!"); });

Float & Int Elements

Float and integer elements provide a way to control values through your menu. This element has many uses: controlling volume, setting the scale of text, or the color of an object!

These elements have three important values:

  • Minimum value - Numbers can't go lower than this
  • Maximum value - Numbers can't go higher than this
  • Initial/starting value - Element's value will start at this number
myPage.CreateInt("X", Color.red, startValue: 0, increment: 5, minValue: 0, maxValue: 255, (value) => { Main.Logger.Log($"X = {value}"); }
myPage.CreateInt("Y", Color.green, startValue: 0, increment: 5, minValue: 0, maxValue: 255, (value) => { Main.Logger.Log($"Y = {value}"); }
myPage.CreateInt("Z", Color.blue, startValue: 0, increment: 5, minValue: 0, maxValue: 255, (value) => { Main.Logger.Log($"Y = {value}"); }

Enum Elements

Enum elements are similar to integer elements, but they simply control enum values. For example, if you have an enum that sets the state of an NPC's behavior, you could control it through this element.

// Assume we're getting an NPC reference here
BehaviourPowerLegs npc = ... 
// Control the agro state of the NPC with this element
myPage.CreateEnum("Agro State", Color.white, npc.AgroType, (value) => npc.AgroType = value); 

String Elements

A new feature of BoneMenu is string elements, which allow you to input strings using a VR keyboard. Through the keyboard, you can input letters, or paste whatever is in your device's clipboard into the element!

myPage.CreateString("Name", Color.white, startValue: "Your Name Here", (value) => MyMod.Player.Name = value);

Bool Elements

Boolean elements allow you to turn features/settings on or off.

myPage.CreateBool("Enabled", Color.white, startValue: false, (value) => MyMod.Settings.Enabled = value);

Dialogs

A dialog in BoneMenu is a window that appears that tells the person important information before doing something.

You can use a dialog to warn the user, for instance, if they're about to delete save data and they'd like to confirm that decision.

private void DeleteData()
{
// ...
}

private void DeleteDataDialog()
{
    Menu.DisplayDialog(
        "WARNING",
        "You are about to delete your data. Are you sure you want to do this?",
        icon: null,
        DeleteData
    );
}

myPage.CreateFunction("Delete Data", Color.red, DeleteDataDialog);

Rich Text

Elements (including pages) use TextMeshPro, which has rich text enabled. This means you can do in-line customization of your strings, which provide more flexibility over BoneMenu's limited options.

NOTE: You do not need to assign a color through an argument. Just keep it as Color.white.

// Make a page and set its rich text color to red
Page myPage = Page.Root.CreatePage("<color=#FF0000>My Page</color>", Color.white);
// Similarly, do more crazy rich text stuff
myPage.CreateFunction("Rotated <rotate=-15>text!</rotate>", Color.white, null);

Clone this wiki locally