Quick answer: Godot 4 C# build missing files that exist in the project? Default export filter excludes some patterns - check the export preset's resource filters.

Custom partial class in res://Scripts/ exists locally; exported PCK doesn't include it. NRE on first reference.

Audit resource filters

Export preset > Resources > Filters to export non-resource files/folders. Confirm *.cs is in the list.

Use the .csproj include

For files outside the standard layout, ensure they're in the .csproj's compile glob. Godot picks up via the csproj, not filesystem walk.

Inspect with godotpcktool

godotpcktool list game.pck | grep .cs

Lists files actually in the PCK. Missing entries point at the filter.

“Export filters are exclude-by-default for many extensions. .cs is one of them on some templates.”

Add a CI step that diffs your project's .cs files against the PCK contents. Drift is rare but disastrous when it happens silently.