Skip to main content

Hot-Reload Script Workflow

The editor watches the project's Scripts/ folder using ScriptWatcher. When a .cs file changes, ScriptManager recompiles all scripts in the folder into a transient DynamicScripts assembly. If compilation succeeds and AutoReloadSceneOnChange is enabled, the scene is reloaded so the new code takes effect immediately.

Key settings (persisted per user, not per project):

SettingDefaultMeaning
EnableHotReloadtrueAuto-compile on file save
AutoReloadSceneOnChangetrueReload scene after successful compile
CompileOnStartuptrueCompile scripts when a project is first opened

The hot-reload assembly is for edit-time only. When you build the game (see Serialization and NativeAOT), the scripts are compiled ahead-of-time as part of the NativeAOT publish step — the source generator runs at that point to emit reflection-free deserialization code.