Build errors disappear from Console if they're in non-editor code

Unity version: 6000.0.28f1
OS: Windows (haven’t tried others)

How to repro:

  1. Create a new Universal 3D project
  2. Create a new C# file in the project
  3. Put some code in that file that’s only broken when outside of the editor. Example:
using UnityEngine;

public class NewMonoBehaviourScript : MonoBehaviour
{
    #if !UNITY_EDITOR
    NOT VALID CODE
    #endif
}
  1. In the editor: File → Build And Run

Expected: the build fails and the errors show up in the console
Actual: the build fails and errors show up briefly in the console but they disappear really fast because there’s another build happening that clears the console

Edit: looks like if I uncheck “Clear on build” and “Clear on recompile” from the dropdown next to the “Clear” button in the Console, the errors remain. It still feels wrong to have to do that by default

5 Likes

I’ve run into this as well. It’s incredibly annoying. You kick off a build, step away from your computer, come back and see no errors in the console - so you think the build succeeded! But no, it failed, Unity just lied to you

Thank you for mentioning I can un-check Clear on Build and Clear on Recompile. Now I actually can see build errors!