Skip to content

Hud

public static class Hud

Namespace Hotline.Api

The Hotline framework’s modder API. Reference Hotline.Api.dll OR drop this single file into your mod. Register a panel and you instantly get a ready-made, toggleable, draggable in-game window inside the one unified Hotline overlay - no custom hotkey, no custom uGUI, no per-mod debug window. One master key opens the overlay; every mod’s controls live there as buttons. Optionally bind a central hotkey to an action and Hotline owns the polling and conflict detection for you.

Every call is a zero-overhead no-op when Hotline is not installed and lights up automatically when it is, so you can ship this unconditionally with no hard dependency.

using Hotline.Api;
Hud.RegisterPanel("MyMod", "My Mod")
.Text(() => "queue = " + _queue.Count)
.Action("Reload", Reload)
.Toggle("Verbose", () => _verbose, v => _verbose = v)
.Hotkey("Reload", HotlineKey.F8, Reload); // optional central hotkey

Tip: a class named HotlineProbe with a static Register() is auto-discovered and called on bind (see AutoRegister), so your mod’s Core does not have to wire anything.

All calls MUST be made from the Unity main thread.

public static bool Available { get; }

True only when the Hotline host is installed AND bound. You rarely need this - the API is a safe no-op when absent.

public static Panel RegisterPanel(string id, string title = null)

Declare a panel: a named, toggleable, movable window in the Hotline overlay that groups everything this mod exposes (text readouts, action buttons, toggles, a log channel). Returns a fluent builder. Load-order-proof; a no-op (the builder still works) if Hotline is absent.

public static void RegisterAction(string panelId, string label, Action run)

A clickable button in a mod’s panel - the in-game replacement for a debug hotkey action. Runs on the main thread when clicked. Load-order-proof.

public static void RegisterToggle(
string panelId,
string label,
Func<bool> get,
Action<bool> set)

An on/off control in a mod’s panel - the in-game replacement for a toggle hotkey. get reports the current state, set applies it; both run on the main thread. Load-order-proof.

public static void RegisterSlider(
string panelId,
string label,
double min,
double max,
Func<double> get,
Action<double> set,
double step = 0d,
string unit = null)

A draggable value in a mod’s panel - the in-game replacement for typing a number into a console to find it. get reports the current value, set applies it; both run on the main thread. The host clamps to [min, max] and snaps to step (0 = continuous), so a setter never sees a value outside its range. Load-order-proof; a no-op on an older Hotline host that predates slider support.

public static void RegisterText(string panelId, Func<string> provider)

A free-text, multi-line readout in a mod’s panel. Polled by the host on the main thread. Load-order-proof.

public static void RegisterImage(string panelId, Func<int[]> provider)

An image in a mod’s panel (e.g. a QR code). The provider returns { width, height, argb0, argb1, ... } - ARGB32 pixels, row-major top-down - or null/empty for “nothing to show”. Polled by the host on the main thread and drawn Point-filtered. Kept as a raw int[] so this shim needs no Unity reference. Load-order-proof; a no-op on an older Hotline host that predates image support.

public static void BindPanelLog(string panelId)

Mark that a panel should display its own log channel (the lines you send via Log / Write with the same id). Load-order-proof.

public static void Log(
string channel,
string message,
LogLevel level = LogLevel.Info)

Send a log line to a channel (use your mod/panel id as the channel). It appears in that mod’s panel log AND in Hotline’s combined timeline. Load-order-proof; a no-op if Hotline is absent.

public static void RegisterHotkey(
string ownerId,
string label,
HotlineKey key,
Action run)

Bind a central hotkey to an action. Hotline owns the key polling and conflict detection, so every mod’s hotkeys live in one place. Pass None to skip the key and only label the action. The same action typically also appears as a panel button. Load-order-proof.

public static void ShowOverlay(bool show)

Added in 1.3.0

Raise or dismiss the whole overlay from code - the same thing the master key does. Lets a mod offer a console command for its HUD instead of relying on a keypress, which nothing can automate or verify. No-op when Hotline is absent or has not bound yet (this one is NOT queued: showing an overlay minutes later, once the host finally turns up, would be a surprise rather than a favour).

public static void ShowPanel(string panelId, bool show)

Added in 1.3.0

Show or hide one panel by id. Showing it raises the overlay too, so a single call is enough to put a mod’s panel in front of the player. No-op when Hotline is absent.

public static bool IsPanelVisible(string panelId)

Added in 1.3.0

Whether a panel is on screen right now (false when Hotline is absent, or the overlay is down).

public static void AutoRegister()

Discover a convention type named HotlineProbe with a static Register() in THIS mod’s own assembly and invoke it once - so a mod never has to wire a Register() call into its Core. Drive it from a [ModuleInitializer] in your probe file. No-op + load-order-proof.