Quick answer: Your game works in the editor but not when built because the editor and build are different environments, and the game relies on something true in the editor but not the build: assets present in the editor but not packaged, code or file paths that only work in the editor, code that's stripped/optimized differently in the build (exposing latent bugs), or timing/performance differences. The build only has what was packaged and runs differently.
"Works in the editor but not when built" is one of the most common and confusing problems in game development. The editor and build are different environments, and the game is relying on something that's true in the editor but not the build.
Why the Editor and Build Differ
The editor is a development environment with conveniences the build doesn't have, so relying on editor-only behavior breaks in the build. Common differences: assets not included (the editor can access all your project assets, but the build only has what was packaged, so a missing-from-build asset works in the editor and fails in the build), editor-only code/paths (code that runs only in the editor, or file paths that work in the editor's structure but not the build's), stripped/optimized code (the build strips and optimizes, exposing latent bugs the editor tolerated, see release-build issues), and timing/performance differences (the build runs at different speed, exposing timing-dependent bugs).
The throughline: the game assumes something the editor provides that the build doesn't. The build is the real target, so anything that only works in the editor is a bug waiting to surface.
How to Diagnose and Fix It
Test the build, not the editor, the fundamental discipline. When something works in the editor but not the build, identify what differs: a missing asset (packaging), editor-only code/path, a stripped/optimized-code difference (a latent bug exposed), or timing. Bugnet captures crashes and errors with context from the build, so build-only failures surface with traces, essential since these bugs by definition don't appear in the editor.
Fix by making the game depend only on what's true in the build: package all needed assets, don't rely on editor-only behavior or paths, fix latent bugs the build exposes, and fix timing-dependent bugs. Make testing the actual build a regular habit. See our guide on fixing a game that works in editor but not in build.
Editor-only behavior breaks in the build because the game relies on something the editor provides and the build doesn't, assets, paths, debug code, or timing. Test the build, not the editor.