The second time you press Play, your game starts wrong. Clean Slate shows you which static fields kept their old values, and puts them back.THE SECOND TIME YOU PRESS PLAY, THINGS BREAKThe score starts at 40 instead of 0. A sound plays twice. Setup code that shouldrun once does not run at all. Restarting the Editor fixes it, for a while.Unity used to reset every static field each time you pressed Play. Fast Enter PlayMode skips that step, so nothing gets reset, and from Unity 6.6 it is the default.WHAT CLEAN SLATE DOESIt records two Play sessions, compares them, and lists every static field that keptits old value: LEAK GameSession._audioInitialised fresh domain False this session True any code behind this guard was skippedFields your startup code fixes on its own move down the list, so what stays at thetop is what is actually broken. Turn cleanup on and Clean Slate resets them for youat the start of every Play session.It catches ScriptableObject assets too. If your game changes one while playing, thechange stays after you stop, in every Unity version, and the next unrelated editwrites it to disk. Clean Slate warns you and can restore the asset exactly.Nothing ships in your game: everything except the [CleanSlateKeep] attribute isremoved from player builds. No dependencies. A sample game with six deliberateleaks is included.FEATURES- Records two Play sessions and compares them, so it reports what actually leaked on this run rather than what could leak in theory- Separates fields your startup code fixes on its own from the ones still wrong after initialisation- Optional cleanup resets statics to their fresh-domain values at the start of every Play session, with a per-field opt-out attribute, [CleanSlateKeep]- Fields that cannot be reset safely are reported, never half-reset- ScriptableObject asset guard: detects, and optionally restores, changes a Play session made to an asset. Applies on every Unity version- Package auditing mode, scanning installed packages alongside your own scripts- Reports a session as unusable instead of as a pass when the comparison would be unreliable- Sample game included, with six deliberate leaks- 38 automated tests- Editor only: everything except the [CleanSlateKeep] attribute is removed from player builds- No dependencies, no third-party code, works with every render pipelineSUPPORTED OSWindows, macOS and Linux Editors. The package contains no platform-specific code:all file access goes through Path.Combine and Application.dataPath. Developed andtested on Windows.LINK TO DOCUMENTATIONhttps://yelyzavetadrevel.github.io/pluginsmith/cleanslate.html




