the symptom, in your words

"An undefined scss variable silently kills the whole panel -- no compile gate catches it"

✓ verified on 26.07.15
lane Building UIposted

▸ SYMPTOM

A razor panel that compiled green — dotnet build clean, in-editor compile_status clean (0 errors / 0 warnings) — vanishes at runtime. In one verified case a HUD hotbar disappeared outright, with nothing in the compiler output to explain it.

▸ CAUSE

An undefined scss variable is a runtime "malformed rule", and no compile gate catches it. If a stylesheet references a variable it never defines — e.g. it uses $text-hi but only ever defines $text — both dotnet build and the editor's compile_status pass clean. At runtime the style parser logs:

snippet
Warn: Skipping malformed rule in /ui/<sheet>.scss: Unknown variable '$text-hi'

and the panel that depends on that sheet can stop rendering entirely — not just lose the one rule.

The usual way in: each razor.scss has its own variable header, and variables do not cross sheets. Copy a rule from one sheet into another and you silently leave its variables behind; the new sheet references a name it never defined.

▸ FIX

Diagnose: when a panel vanishes despite a green compile, don't debug the C# — check the runtime console:

snippet
read_console minimumLevel=Warn      # then grep for: malformed rule

Fix: define the variable in that sheet's header (variables are per-sheet), or switch the rule to a variable the sheet already defines. Verified 2026-07-17: a hotbar vanished in play, the console showed Skipping malformed rule ... Unknown variable '$text-hi', and defining the variable restored the panel after an editor restart.

▸ RELATED TRAP: HOTLOAD SUBSTITUTION FAILURES

Seen the same day: heavy hotload churn can fail lambda substitution (Unable to find matching substitution for a lambda method), leaving a mixed old/new assembly — stale keybinds or UI despite green compiles. A play-session restart does not clear it; a full editor restart does. If UI behaves like an old build after big merges, check the console for hotload substitution warnings before you go hunting for "bugs" that don't exist in the current code.

▸ WHY IT WORKS

Both build paths validate C# and Razor codegen, but scss variable resolution happens later, in the runtime style parser — so a missing variable is invisible until the sheet is actually parsed on screen. Because the parser reacts by skipping the whole malformed rule (and the panel can collapse without it), the only reliable signal is the runtime Warn line. Treating "green compile + vanished panel" as a cue to read the console, rather than to re-read the code, is what turns a mystery into a one-line fix.

Verified on engine 26.07.15: seen in a real project.
s&box moves fast; an undated fix is a liability. Spot a stale detail?
changelog
  • Published

Want to know when new guides or fixes drop? Join the community to help build this out. Report gotchas, flag outdated fixes, or just lurk.

Join the Discord