Navigation
Browse the developer docs

FH2 Mod Platform for .NET

UI and Hud

The game's HUD notification, and whether the HUD is showing.

By Bartholomew Ho (qiangqiang101) · MIT license · v0.12.0 · 15 Nov 2026 · repository · original page

On this page

UI shows the game's own HUD notification (the panel with a title and a line of text that the game uses for skills and rewards). Hud tells you whether the speedometer is up, and feeds values to a speedometer of your own.

Thread: any. Both classes can be used from any thread.

UI

Example

Show a notification when your mod starts.

protected override void OnInit()
{
    UI.Notify("My Mod", "Loaded. Have fun!");
}
Protected Overrides Sub OnInit()
    UI.Notify("My Mod", "Loaded. Have fun!")
End Sub

Members

MemberWhat it does
Notify(string title, string text = "") (method)Shows title with text under it, as the game's HUD notification.
IsReady (property, bool)True once notifications can be shown (the game's code was checked).

Notes

With FH2 Mod Platform 2.9.0 or later (new in 0.12.0), notifications are the platform's pop-ups:

  • One queue for every mod, spaced around the game's own notifications. They wait while you're in a menu, loading, in photo mode or a replay, and one that can't show within 2 minutes is dropped.
  • The title shows up to 28 characters, in capitals; the line under it up to 45. Longer text ends with ....
  • Up to 4 wait at once. For hosted mods and scripts that's all of them together, because they show under Platform.NET's name. A 5th drops the oldest waiting one.
  • The player decides whether they show: the Pop-ups row on Platform.NET's page (a NativeAOT mod gets the row on its own page), the platform's Mod pop-ups row, and the game's own Minor notifications option.
  • platform.log lists each one shown, with its text.

On older platforms, the SDK shows them itself:

  • One at a time, about 5 seconds apart, only while you're driving. One sent during a loading screen, a menu or an event's intro waits until you're on the road again; one that can't show within 2 minutes is dropped. (A teleport rebuilds the HUD, so "Teleported!" shows a few seconds after you land.)
  • Up to 8 wait in line; more drops the oldest waiting one.
  • About 100 characters fit on a line. Longer text is cut and ends with ....
  • platform.log says when one shows, waits for the HUD, or is dropped (lines starting UI.Notify:).
  • On a game build the SDK doesn't support, nothing shows and IsReady stays false. platform.log says why.

Either way, any language shows, as long as the HUD's font for the game's language has the characters: Chinese text with the game in Chinese, say. (Before 0.10.0, anything outside ASCII showed as ?.)

Hud

The speedometer's XAML (ui/Controls/HUDSpeedometerControl.xaml) binds to the RPM gauge's number items: RPMGaugeNumbers[n].XPos and RPMGaugeNumbers[n].YPos. Items 16 to 20 are not used by the game. Replace that XAML with your own (using SetFile on your mod), set items 16 to 20 with SetGaugeItem, and bind your own gauge parts to them (for example a bar's Ratio, a glow's angle, or an Opacity).

Example

Feed the car's speed to gauge item 16, as a value from 0 to 1.

protected override void OnInit()
{
    Game.Tick += () =>
    {
        if (Player.Car is { } car)
            Hud.SetGaugeItem(16, Math.Min(car.SpeedKmh / 400f, 1f), 0f);
    };
}
Protected Overrides Sub OnInit()
    AddHandler Game.Tick, Sub()
                              Dim car = Player.Car
                              If car IsNot Nothing Then
                                  Hud.SetGaugeItem(16, Math.Min(car.SpeedKmh / 400.0F, 1.0F), 0.0F)
                              End If
                          End Sub
End Sub

Members

MemberWhat it does
IsReady (property, bool)True if the HUD can be read and fed (the game's code is as expected).
IsSpeedometerShown (property, bool)True while the speedometer is up: you're driving with the HUD showing. False in a menu, the garage, a car meet lobby, a race intro, a rewind or photo mode.
SetGaugeItem(int index, float x, float y) (method)Sets RPM gauge item index to x (its XPos) and y (its YPos), for the speedometer XAML to show. Items 16 to 20 are free for your own use. ⚠️ Not tested much in the game yet.
ClearGaugeItems() (method)Stops setting the gauge items. They keep their last values until the game sets them.
HideAll (property, get/set, bool)Hides all of the game's UI (the HUD, the map, menus) for screenshots or a cinematic camera. It comes back by itself when the pause menu opens, so the player is never stuck in a menu they can't see. New in 0.12.0.

Notes

  • SetGaugeItem takes an index from 0 to 20. Any other index throws ArgumentOutOfRangeException.
  • Items 0 to 15 are the game's own numbers. You can set them, but 16 to 20 are the ones meant for you.
  • Values are applied every HUD frame, so set them whenever you like. You don't need to be on the game thread.
  • On a game build the SDK doesn't support, Hud switches itself off: IsReady stays false and platform.log says so.

See also

Copied from the wiki page UI-and-Hud at commit 7396a07 · MIT license
MIT License

Copyright (c) 2026 Bartholomew Ho

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.