tag

#compile-error

20 items (20 fixes)

fixes
26.07.15a
"[GameResource] and NavMesh.GetSimplePath are obsolete on engine 26.07: use [AssetType] and CalculatePath"

On engine 26.07 both [GameResource] and NavMesh.GetSimplePath are marked [Obsolete] (CS0618), so a zero-warnings build gate fails on them. Replace [GameResource(...)] with [AssetType(...)] and GetSimplePath with NavMesh.CalculatePath, which returns a NavMeshPath of NavMeshPathPoint (not List<Vector3>).

26.07.08e
"@ref on a bare private field silently never assigns"

@ref on a private field compiles with only a CS0649 warning: the ref stays null at runtime. Bind to a property instead.

26.07.22
"A property initializer that reads another property compiles headless but breaks the editor (CS0182)"

public int X { get; init; } = SomeClass.SomeProperty; passes headless dotnet build but fails the editor compile with CS0182: the editor's code generator embeds initializers where only constants are legal. Default to a constant sentinel and resolve later.

26.07.22
"An XML doc comment on the field's own line deletes the field"

A single-line XML doc comment that shares a line with the field it documents pulls the declaration into the comment. The compiler then sees no field at all. Nothing fails at the comment site. The break shows up later as a 'does not contain a definition' error wherever the field is used, which reads like a typo or a missing using. Put every XML doc comment on its own line, directly above the member.

26.07.15a
"Custom GameResource extension must be 8 characters or fewer"

A custom GameResource with a file extension longer than 8 characters silently never registers as a compilable source type. Every asset fails with "no source file." Keep extensions to 8 lowercase chars or fewer.

26.07.08e
"Disabling per-instance shadows on ModelRenderer"

ModelRenderer.CastShadows doesn't exist as a settable property: use renderer.SceneObject.Flags.CastShadows instead.

26.07.08e
"Editor stuck running stale assembly with green compile: only a restart clears it"

compile_status is fully green and the editor accepts edits, but Play executes the OLD code: touch, syntax-error cycling, and play restart all fail. Only a full editor process restart clears it.

26.07.08e
"FileSystem is ambiguous in editor assemblies: CS0104 between Editor.FileSystem and Sandbox.FileSystem"

An unqualified FileSystem compiles in a game assembly but CS0104s in an editor assembly: fully-qualify Sandbox.FileSystem in editor code.

26.07.08e
"Fixing a source asset doesn't always trigger recompilation"

ERROR models or white materials persist after fixing the source: delete the compiled artifact AND touch the source file to force recompilation, or poke asset_compile per source file.

26.07.15a
"Git worktree at different depth breaks sbox csproj relative references"

A git worktree at a different directory depth than the main checkout breaks the generated csproj's relative references to the sbox install: dotnet build fails with missing-assembly errors.

26.07.08e
"Green compile_status coexists with a stale play-mode hotload reporting phantom errors"

compile_status shows Success and dotnet build is green, but play mode reports errors for symbols and lines that no longer exist in source: the play-mode hotloader compiled a stale mid-edit snapshot.

26.07.15a
"Hand-vendored library without an .sbproj is silently skipped"

The editor discovers a library under Libraries/ only if the folder contains exactly one .sbproj file. A hand-vendored library without one is silently ignored, producing a wall of CS0246 errors on every type it defines.

26.07.18
"Offline two-assembly compile gate with prebuilt base library"

A consumer game plus a vendored library can be compile-gated fully offline using two scratch csprojs against the editor install's prebuilt base library DLL.

26.07.08e
"PanelComponent uses OnTreeBuilt, not OnAfterTreeRender"

OnAfterTreeRender(bool) is a Panel hook: on a PanelComponent it fails with CS0115; use parameterless OnTreeBuilt() or OnTreeFirstBuilt().

26.07.08e
"RZ1010 error from nested @{ } inside a Razor code block"

Nesting @{ } inside an already-open Razor code block (like @if or @for) causes RZ1010: you're already in C#, so drop the @.

26.07.08e
"Scaffolded project missing global using System in Assembly.cs"

A freshly-scaffolded project's Assembly.cs can be missing global using System. Transplanted code using Math/MathF fails with CS0103.

26.07.08e
"ScenePanel Camera is read-only: configure it in place for 3D previews"

ScenePanel's Camera property is GET-ONLY. Assigning a new SceneCamera fails with CS0200. Configure the existing camera in place and build the preview world manually.

26.07.08e
"TextEntry is the house control, not HTML input"

Use TextEntry with onsubmit and OnTextEdited: standard Blazor input bindings compile but are not how the engine UI works.

26.07.15a
"TextEntry.OnTextEdited needs an explicit-type block lambda"

An untyped or expression-bodied lambda on TextEntry.OnTextEdited fails with CS8917 or CS0029. Use an explicit param type plus a block body.

26.07.08e
"Unknown shader field? Check the engine's own templates before grepping projects"

Shader field support is unknown and no .shader source exists: check the install's templates/ folder for authoritative syntax instead of grepping sibling projects.

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