Search Unity

Error Building Player With Compiler Errors [Fixed]

Discussion in 'Scripting' started by Nigey, Apr 23, 2019.

  1. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Hi Guys,

    I'm having a very strange problem. My project has been working for multiple builds today and has done for months. I've just tried to make a build again like I do all the time. It's saying it's failing due to compilation errors. However, it's working okay in the player.

    I've taken a look at the Editor.log file, and it's saying this:

    DisplayProgressNotification: Build Failed
    Error building Player because scripts had compiler errors

    (Filename: Line: -1)


    I have no idea what this means. Is it supposed to be giving me more data than this? Can anyone advise?
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    There must be other messages nearby. Have you tried lurking deeper into the console window?
     
    Nigey likes this.
  3. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    Before you go and start pulling out your hair - I found that it sometimes helps to shut down first Unity, then your whole Computer, re-boot and try again. Have you done that alrady? I know it'a pain with large Projects, but (especially on Windows), I find that I need to reboot once a week to Keep small things from piling up and turning into big things..
     
    Nigey likes this.
  4. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Let me go give that a bash!
     
  5. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    I found it! For anyone for future reference, looking deep into the editor log really does help. I found I'd written something that was editor only in a MonoBehaviour when overriding GridLayoudGroup:

    Code (CSharp):
    1.  
    2.         protected override void Reset()
    3.         {
    4.             TryMatchParent();
    5.             base.Reset();
    6.         }
    Seems all good now!
     
  6. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    But didn't you say that you had successful builds before? How did it compile it then, and now stopped? Or did you add the Editor script recently?
     
  7. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Yeah I'd added the editor script inbetween the previous build, and had only done regular play mode tests to confirm things are working (as my builds shut me out for about 30 mins). It wasn't until I hit build that it conked out. I was pretty surprised that methods extensible from MonoBehaviour would actually cause compilation errors on build, but it seems Reset is editor only (https://docs.unity3d.com/ScriptReference/MonoBehaviour.Reset.html).

    Thanks for all the listening guys!