# FailBuildWhenErrorsLogged

> Fail the build if any errors are logged while it runs.

## Definition

* **Type:** Field
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
FailBuildWhenErrorsLogged = 512
```

### Remarks

Without this flag, non-fatal errors, such as a failure to compile a shader for a particular platform, don't cause the build to fail, but might result in incorrect behavior at runtime.

Always set this flag, unless errors are logged from packages or other third-party code that you can't fix, and you need the build to proceed despite them.

When this flag is set, errors logged from these build callbacks also fail the build: [IPreprocessBuildWithContext.OnPreprocessBuild](/engine/6000.7/script-reference/unityeditor/build/ipreprocessbuildwithcontext/onpreprocessbuild.md), [IPostprocessBuildWithContext.OnPostprocessBuild](/engine/6000.7/script-reference/unityeditor/build/ipostprocessbuildwithcontext/onpostprocessbuild.md), [IProcessSceneWithReport.OnProcessScene](/engine/6000.7/script-reference/unityeditor/build/iprocessscenewithreport/onprocessscene.md), [IPreprocessShaders.OnProcessShader](/engine/6000.7/script-reference/unityeditor/build/ipreprocessshaders/onprocessshader.md), and [IPreprocessComputeShaders.OnProcessComputeShader](/engine/6000.7/script-reference/unityeditor/build/ipreprocesscomputeshaders/onprocesscomputeshader.md).

This flag is the content directory equivalent of [BuildOptions.StrictMode](/engine/6000.7/script-reference/unityeditor/buildoptions/strictmode.md).

Additional Resources: [BuildOptions.StrictMode](/engine/6000.7/script-reference/unityeditor/buildoptions/strictmode.md), [BuildAssetBundleOptions.StrictMode](/engine/6000.7/script-reference/unityeditor/buildassetbundleoptions/strictmode.md)
