Repository navigation
SettingsTile
Bartholomew Ho edited this page Nov 9, 2026
·
1 revision
Gives your mod a tile of its own on Pause > Settings, next to Controls. The tile opens a page with only your mod's rows, instead of having them among every mod's rows on the MODS pages. A keyboard-and-mouse mod with many options (key bindings, mouse speed) can use it so players find them easily.
Thread: call Add from your mod's OnInit. RefreshRow and IsShown work from any thread.
A tile called MOUSE with two rows, and a "Preset" row that sets the other two.
using FH2;
using FH2ModPlatform;
public sealed class MouseSettings : Mod
{
public override ModInfo Info => new("MouseSettings", "1.0.0");
protected override void OnInit()
{
AddSetting(new SliderSetting("Speed", "Mouse speed", 1, 0.1f, 3));
AddSetting(new ToggleSetting("Invert", "Invert mouse Y", false));
AddSetting(new ChoiceSetting("Preset", "Preset", ["Custom", "Default", "Fast"], 0)
{
Changed = choice =>
{
if (choice == 0) return;
SetSlider("Speed", choice == 2 ? 2 : 1);
SetSetting("Invert", false);
SettingsTile.RefreshRow("Speed");
SettingsTile.RefreshRow("Invert");
},
});
// After the rows: the tile, its title, and what's drawn on it.
SettingsTile.Add(this, () => "MOUSE",
"<Border Width=\"160\" Height=\"110\" BorderBrush=\"#FFDCDCDC\" BorderThickness=\"10\" CornerRadius=\"20\" />");
}
}Imports FH2
Imports FH2ModPlatform
Public Class MouseSettings
Inherits [Mod]
Public Overrides ReadOnly Property Info As ModInfo
Get
Return New ModInfo("MouseSettings", "1.0.0")
End Get
End Property
Protected Overrides Sub OnInit()
AddSetting(New SliderSetting("Speed", "Mouse speed", 1, 0.1F, 3))
AddSetting(New ToggleSetting("Invert", "Invert mouse Y", False))
AddSetting(New ChoiceSetting("Preset", "Preset", {"Custom", "Default", "Fast"}, 0) With {
.Changed = Sub(choice)
If choice = 0 Then Return
SetSlider("Speed", If(choice = 2, 2.0F, 1.0F))
SetSetting("Invert", False)
SettingsTile.RefreshRow("Speed")
SettingsTile.RefreshRow("Invert")
End Sub
})
' After the rows: the tile, its title, and what's drawn on it.
SettingsTile.Add(Me, Function() "MOUSE",
"<Border Width=""160"" Height=""110"" BorderBrush=""#FFDCDCDC"" BorderThickness=""10"" CornerRadius=""20"" />")
End Sub
End Class| Member | What it does |
|---|---|
IsShown (property, bool) |
True once the Settings page has been given the tile. The page is read when it first shows, so this is false until then. |
Add(Mod mod, Func<string> title, string pictureXaml) (method) |
Gives mod the tile. Call it from OnInit, after adding your rows. title is the tile's and the page's title; it's asked each time they're read, so it can follow the game's language. pictureXaml is what's drawn on the tile. |
RefreshRow(string key) (method) |
Makes the open page show a row's new value, for rows you changed yourself (a preset row that sets other rows). The row the player changed updates by itself. |
-
One mod per game.
AddthrowsInvalidOperationException("Another mod has the Settings tile.") if a mod already has it. - The picture is XAML placed inside the tile's grid, about 280 x 280. Draw it in the light grey of the game's icons,
#FFDCDCDC. - The title can hold any characters, not only English letters.
- Opening the tile shows only your rows. The MODS pages then leave your rows out, so they're never listed twice.
-
RefreshRowworks on the tile's page. Call it from a row'sChangedhandler, as in the example: the rows you name are shown again right after that handler returns. Change the values withSetSettingorSetSliderfirst. - Unsupported game build: if the Settings page or its code isn't as expected, the tile isn't added, your rows stay on the MODS pages as usual, and platform.log says "SettingsTile off: ..." or "SettingsTile: ... the rows stay on the MODS pages". Your mod keeps working either way.
- For a hosted mod, the platform's Hosted .NET mods page tells players where its settings are (Pause > Settings > your title).
- Your first mod in C# and Your first mod in VB: adding settings rows.
- Menus and UiElement
- Home
Playing
Getting started
Writing mods
The FH2 classes
- Game
- Player
- Vehicle
- World
- Garage, CarCatalog, Profile
- UI and Hud
- Camera
- Audio
- ANNA
- Skills
- DebugOverlay
- Controller
- GameInput
- GameWindow
- Menus and UiElement
- SettingsTile
- ButtonIcons and Picture
- MapView, PhotoCamera, GarageCamera
More