Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Error building Player because scripts have compile errors in the editor.

Discussion in '5.5 Beta' started by sgower, Oct 21, 2016.

  1. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    315
    In the recent 5.5 betas (have have the latest 5.5b8) I can't get my project to build. I get an "Error building Player because scripts have compile errors in the editor". But I'm able to play my game fine in the editor, and I see no compile errors in Visual Studio when I run builds. In the Unity Console, the only error I see is the "Error building Player" error.

    Does anyone have any thoughts about what I should checked? I had no problems building in previous Unity versions (I'm not quite sure what version I last ran the build with).
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    8,427
    Can you post your editor log when this happens?
     
  3. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    315
    Hi, thanks. I was able to resolve this by checking the editor log which showed the errors. I was expecting to see the errors either in the Unity console, or in the Visual Studio build console. Perhaps the error should be modified with instructions to check the Editor log file which would be helpful for people who don't immediately know to do this.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    8,427
    The errors should appear in the editor console. If they don't, then that's definitely a bug. Can you reproduce this consistently?
     
  5. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    315
    Hi, sorry for the late response, I sometimes forget to check back here. Yes, well this seems to be happening consistently. It did happen to me again today when I tried to run a build, but some of my script were using "using UnityEditor;" which evidently isn't allowed in a built application. I received the same message in the console that said "Error building Player because scripts have compile errors in the editor", but the actual errors again were once again not displayed. I needed to dig through the Editor log and search for "Error" to see what the errors were.

    Hope this helps! On a side note: I sure wish UnityEditor was something available at Runtime. In my game (it's a VR world builder game), I'd like the user to be able to construct objects in-game that will get saved as Prefabs. So I'd like to be able to do this:

    Code (CSharp):
    1.  var prefab = EditorUtility.CreateEmptyPrefab(savePrefabPath);
    2.         EditorUtility.ReplacePrefab(this.gameObject, prefab);
    It seems that saving an loading user-generated content (in the form of prefabs) is a valid use-case, and something developers would like to have. Are there technical reasons why adding this functionality to runtime builds isn't feasible?
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    8,427
    Well, for starters, prefabs are an editor only concept. They don't exist in the player.

    Either way, could you try making a small project that reproduces this issue, submit a bug the editor and tell me the case number?
     
    Hassan-Kanso likes this.
unityunity