Eighteen files, every capital letter wrong
Eighteen source files were rewritten in a rolling sweep — and every one of them was untracked in git. Not a coincidence: the sweep hit the newest work, which is exactly the work not yet committed. Git had nothing to restore.
The damage was a case flip on the first letter of identifiers.
GUIContent.none became None, GUILayout.Button became
button, and in one file the local player and the type
Player swapped places. None of it compiled, which was the good news.
The bad news was the line that did. In a switch statement,
default: had become Default: — and C# reads that as a goto label,
not a switch default. The branch silently vanished. The compiler only muttered that not all
code paths return a value; had the method returned void, it would have compiled clean and
simply stopped handling the last case.
The flip also reached string literals, where nothing complains at all. One plugin's GUID
read "robbin.valheim.Devkit" instead of .devkit — perfectly valid,
and it silently changes which config file the plugin writes.
What saved it was the compiled output. The DLLs had been built minutes before, from clean source, so decompiling them recovered the lost members exactly — including full config descriptions, word for word. Ten repositories now build clean again.
Two habits came out of it. Commit before you think you need to; the work that gets lost is always the work not yet committed. And when a build is green, the binary is a snapshot of a source tree that may not survive — which is a strange thing to be grateful for.