- Home /
Unity compile error fills console on project startup
Running 18.1.5f1 personal on a Windows 10 PC.
I installed CineMachine via Package Manager, then began to see these messages. I closed my project and created a new project.
Immediately on opening the new project, these messages began and fill the console (999+). I created another empty project and deleted CineMachine but the messages continued in this third project.
NullReferenceException: Object reference not set to an instance of an object UnityEditor.Scripting.Compilers.ScriptCompilerBase.CompilationHadFailure () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/ScriptCompilerBase.cs:342) UnityEditor.Scripting.Compilers.ScriptCompilerBase.DumpStreamOutputToLog () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/ScriptCompilerBase.cs:356) UnityEditor.Scripting.Compilers.ScriptCompilerBase.GetCompilerMessages () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/ScriptCompilerBase.cs:335) UnityEditor.Scripting.ScriptCompilation.CompilationTask.Poll () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CompilationTask.cs:105) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.PollCompilation () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1031) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.TickCompilationPipeline (EditorScriptCompilationOptions options, BuildTargetGroup platformGroup, BuildTarget platform) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1024) UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface+c_AnonStorey4.<>m_0 () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:266) UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.EmitExceptionAsError[CompileStatus] (System.Func`1 func, CompileStatus returnValue) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:85) UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)
Reinstall Unity. Or upgrade to next stable build. Like 2018.1.1a -> 2018.1.4f
Answer by ageeu · Apr 16, 2019 at 05:52 PM
These NullReferenceException error messages are a result of the project referencing an older version of .NET Framework.
The Fix:
Select "Project Setting > Player" from the "Edit" menu bar item
Select the "Other Settings" group tab under the [Down-arrow]
Change the "Scripting Runtime Version" to say ".NET 4.x Equivalent"
Select "Save Project" from the "File" menu bar item
Restart Unity
You should no longer see any the errors in the Console view.
Answer by georgesmuga · Jun 28, 2018 at 01:25 PM
Figuring that these errors were the result of 'project spaghetti', I decided to delete Unity 18.1.5f1 and load a fresh copy of the latest.
This morning I installed Unity 18.1.6f1 and opened an empty project. The error messages did not recur so, apparently, all is well.