Create a clean build
Rebuild all content from scratch without using cached results to resolve build cache issues.
阅读时间1 分钟最后更新于 15 天前
By default, Unity creates builds incrementally, however the incremental pipeline can cause caching issues, or incomplete builds. For example, Unity serializes scenes and assets for the target platform during the build process, and either reuses all content from the previous build, or rebuilds everything. However, this detection might fail when global settings affect build output. You can create a clean build to resolve this issue.
When Unity creates a clean build, it discards some cached build data but reuses previously imported assets and cached shaders to rebuild all content and code. Use a clean build when preparing release builds or troubleshooting issues caused by corrupted or outdated build caches.
To create a clean build:
- Open the Build Profiles window (File > Build Profiles).
- Next to the Build button, select the drop-down.
- Select Clean Build.
You can also create a clean build from a build script by passing in the call to .
BuildOptions.CleanBuildCacheBuildPipeline.BuildPlayerIf you don't want Unity to reuse imported assets and cached shaders, you can delete the folder to force Unity to repeat all imports and shader compilation. This approach increases build time but helps avoid issues that might occur at earlier stages of the build process.
LibraryTo create a clean build without using cached shaders and assets:
- Close the Editor.
- Delete the folder
Library - Use the previous instructions to create a clean build.