Mega UI
FAQ
The questions that come up, and the ones that turn out to be the same question wearing a hat.
My app does not appear on the desktop
In order of how often it turns out to be each one:
- MegaUI.dll is not installed. With
HardDependency, BepInEx says so in the log and does not load your plugin at all. - Your
Registernever ran. Search the log for[api]and your guid — there is a line for every registration. - You have not reached a store yet. The desktop is built when the computer exists; registering before that is normal and expected.
- BepInEx 6 instead of 5. Nothing loads at all, which looks identical to a broken mod.
Do I need Mega Tree?
No. They are separate downloads that do different things: Mega Tree is a tree of upgrades, Mega UI is a window with your own screen in it. A mod can use one, the other, or both.
Why does my number never change?
You almost certainly passed a string instead of a function.
// Read ONCE, when the screen was built. Frozen forever.
ui.Label($"Boxes: {Warehouse.Count}");
// Read on EVERY open.
ui.Value(() => $"Boxes: {Warehouse.Count}");When do I call Refresh?
When the shape changed, not when a number did. A row that should no longer exist, a section that only appears once something is unlocked. Numbers handle themselves.
Can I put a text field on my screen?
Yes — ui.TextField. While it has focus the keyboard belongs to it, so typing
does not walk the player across the shop, and your setter is called when the edit ends rather than
on every keystroke.
Can I change the colours?
All of them. Start from UiTheme.Light or UiTheme.Dark, change what you
like, or build one from scratch — and any widget takes its own colour on top of that. See
Look and feel.
My screen is longer than the window
Then it scrolls, and you did nothing. There is no Scrollable flag on purpose: whether
a screen fits depends on the shape of the player's monitor and on their language — the
same screen fits in English and overflows in German. Nobody gets that guess right while writing the
mod. The library measures.
For a drawing that is bigger than the window on both axes — a tree, a map — use a region, which the player can drag and zoom.
How do I control where my icon goes?
SortOrder, low numbers first. But leave it at 0 unless you have a real reason: if
everyone picks a big number to be near the top, the field stops meaning anything.
Two mods used the same guid. What happens?
The second registration replaces the first, because the guid is the identity. Use your BepInEx plugin guid, which is already unique, and this never comes up.
My app's window opens behind the game's
It should not — opening yours minimizes the game's, and vice versa. If you can reproduce it, that is a bug worth reporting with the log; it was the exact defect the one-window-at-a-time rule was written to kill.
Can I draw something Mega UI does not have a widget for?
Not through the public API, deliberately. If you need something that is not there, ask for it — reaching into the internals gets you a mod that breaks on the next release, and the gap never gets filled because nobody said it existed.
Does it cost frames?
Your screen is built once, then only rebuilt when you call Refresh. The per-open work
is reading your Funcs, so the cost is whatever your functions cost. Keep them cheap and
there is nothing to measure.
Will my mod break when Mega UI updates?
Not from a new widget or a new field. ApiVersion only moves on a real breaking
change — see Versioning. Colours and spacing are allowed
to change, and your app changes with them.
Where is the log?
BepInEx/LogOutput.log, in the game folder. Copy it before reopening
the game — the game wipes that file on every launch. Everything Mega UI writes is prefixed
[ui] or [api].