Unity Enter Play Mode Settings: diagnosing stale static state across Play sessions when Reload Domain is disabled
0 reputation · 04 Aug 2020, 20:31 UTC
0 reputation · 04 Aug 2020, 20:31 UTC
Project Settings > Editor > Enter Play Mode Settings allow disabling Reload Domain and Reload Scene for faster iteration. With Reload Domain disabled, the AppDomain persists across Play sessions, so static fields, cached singletons, and some event subscriptions survive and a run can reflect prior state rather than a clean start. With Reload Scene also disabled, runtime edits to the open scene persist, so Awake and Start paths may not execute as in a build.
The trade-off is project-specific: iteration time saved by skipping reloads must be weighed against stale static state, and balance changes with project size, static-state usage, and whether reproducible Play sessions matter. Version sensitivity adds uncertainty, as these options and RuntimeInitializeLoadType members were refined across the 2019.3-era through current LTS and Unity 6 releases, so defaults and supported load types must be confirmed per Editor version.
The hook, [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)], runs each Play session even when domain reload is disabled, but relying on it requires confirming that every static path is covered. Under what conditions should a project disable Reload Domain and Reload Scene while keeping Play sessions reproducible? How can a team confirm that no static state or scene mutation leaks between Play sessions in the Editor version? Which RuntimeInitializeLoadType members and default Enter Play Mode values must be verified against release notes before adopting one?
Disable Reload Domain and Reload Scene only when the project either contains no persistent static mutable state and no runtime scene mutations, or when every such state is deterministically reset at the start of each Play session. If static fields, cached singletons, or event subscriptions survive between sessions—or if the open scene is modified at runtime—Play sessions will reflect prior state rather than a clean build.
The likely explanation for stale behavior is that the AppDomain persists across Play sessions when Reload Domain is disabled, so static state survives. Confirmed behavior: with Reload Scene disabled, runtime edits to the open scene persist, meaning Awake and Start paths may not execute as they would in a standalone build.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] and use it to null or reset known static state. This hook runs each Play session even when domain reload is disabled, but it does not automatically reset arbitrary static state—you must cover every path.Because these options and API members were refined across the 2019.3-era through current LTS and Unity 6 releases, treat any specific default or member name as version-dependent until checked against your Editor's release notes. Confirm the exact RuntimeInitializeLoadType members and their casing for your version. Documented members include AfterAssembliesLoaded, BeforeSplashScreen, BeforeSceneLoad, AfterSceneLoad, and SubsystemRegistration, but availability and spelling have changed across releases. Also confirm the default Enter Play Mode values in Project Settings > Editor; Reload Domain and Reload Scene are typically enabled by default, but defaults and UI labels have been refined over time.
Does the project contain static mutable state or runtime scene edits? If neither exists, disabling reloads is lower risk. If either exists, explicit reset logic is mandatory before disabling.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.