Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Continuing to have bugs when building game... "BuildFailedException"

Discussion in 'Editor & General Support' started by andreas_mavromm, Apr 25, 2023.

  1. andreas_mavromm

    andreas_mavromm

    Joined:
    May 9, 2019
    Posts:
    14
    So I recently purchased an entirely new MacBook Pro - 14" w/ an Apple M2 Pro Chip - with the purpose of dedicating it to game development...

    I downloaded the most recent LTS version of Unity (Unity 2021.3.23f1) and opened a URP project. I then exported the basic scene that is included when you first load up a new project - so *NO* extra code, assets, anything, etc. - and I am thrown a million errors:

    Building Builds/buh_8_test.app/Contents/MacOS/buh_8 failed with output:

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)

    BuildFailedException: Incremental Player build failed!
    UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/BeeBuildPostprocessor.cs:604)
    UnityEditor.OSXStandalone.OSXDesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/PlatformDependent/OSXPlayer/Extensions/Managed/OSXDesktopStandalonePostProcessor.cs:117)
    UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:28)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)

    Build completed with a result of 'Failed' in 3 seconds (3421 ms)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)

    UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ce] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPlayerWindowBuildMethods.cs:194
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)

    I am really trying to make sense of all of this... How can I already have issues if I have not written any code or loaded any assets? This has been an ongoing issue with Unity in the past and what helped was updating the Editor to the most recently released LTS version, however I have already done this so I cannot go "further" at this point and download a more recent, updated version of the Editor.

    Would trying to build my game on a previous LTS version of Unity that actually WORKED FOR ME - I believe it was 2020.3.46f1 - be a potential fix? On that LTS version, everything was functional and I was able to build my game without any errors. Is this course of action - working backwards in LTS versions to find a version that actually WORKS - advised against, or recommended? Like, if I build a game on an older version of the Unity editor, will I run into issues at some point because it's outdated, or can I still do this?

    This may seem like a stupid question but... why is Unity like this? Looking at their downloads page reveals a LOOONG list of "versions" of the Editor that is updated every - 2-3 weeks?! Does this mean as game developers, we are constantly expected to download a new version of the editor every few weeks? How is this efficient for Unity, and even conceivably tolerable for game developers?

    Am I failing to understand something basic here? I would understand if I had a huge project but once again, my Editor is failing to even build a project with just a light and camera. Weird.

    Screenshot is provided :) Thank you in advance.
     

    Attached Files:

    RemDust likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    37,136
    How to troubleshoot build failures:

    First, make a blank project with a single blank scene and prove that it builds successfully.

    If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

    Until you can build a blank project to the target platform, don't fiddle with anything else.

    Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

    Most often things that prevent building are third-party libraries such as Firebase.

    Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

    It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

    Android build not building:

    Recently (circa July 2022) there have been reports of Unity's installer failing to install the Android Tools.

    https://forum.unity.com/threads/cant-build-for-android.1306098/

    Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022:

    https://forum.unity.com/threads/aab...y-2021-3-8-with-jdk-1-8.1322211/#post-8551193

    Android Gradle errors and other related stuff:

    https://forum.unity.com/threads/unity-gradle-bug-please-help.1368018/#post-8625789

    Oh my ... no. Never.

    ISSUES RELATED TO UPGRADING PROJECTS (eg, changing to a higher Unity version)

    Upgrading to a later version of Unity is a one-way process. Any project that has been updated should NEVER be reverted to an earlier version of Unity because this is expressly not supported by Unity. Doing so exposes your project to internal inconsistencies and breakage that may actually be impossible to repair.

    If you want to upgrade to a newer version of Unity, do not even consider it until you have placed your project fully under proper source control. This goes double or triple for non-LTS (Tech Stream) versions of Unity3D, which can be extremely unstable compared with LTS.

    Once you have source-controlled your project then you may attempt a Unity upgrade. Immediately after any attempted upgrade you should try to view as much of your project as possible, with a mind to looking for broken animations or materials or any other scripting errors or runtime issues.

    After an upgrade you should ALWAYS build to all targets you contemplate supporting: iOS and Android can be particularly finicky, and of course any third party libraries you use must also "play nice" with the new version of Unity. Since you didn't write the third party library, it is up to you to vet it against the new version to make sure it still works.

    If there are issues in your testing after upgrading Unity, ABANDON the upgrade, revert your project in source control and be back where you were pre-upgrade with the earlier version of Unity.

    Obviously the less you test after the upgrade the more chance you will have of an undiscovered critical issue.

    This risk of upgrading is entirely on you and must be considered whenever you contemplate a Unity version upgrade.

    Do not upgrade "just for fun" or you may become very unhappy.
     
  3. andreas_mavromm

    andreas_mavromm

    Joined:
    May 9, 2019
    Posts:
    14
    Thank you for your response Kurt, I appreciate your advice. I still have some questions (if you don't mind helping further).

    "If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc."

    If I'm not building for Android (trying to build for Mac and Windows), can't I ignore these tools?

    "Most often things that prevent building are third-party libraries such as Firebase."

    How can I find out what third-party libraries I need to modify/delete? Is there a way I can translate the horrific red gobbledygook the Editor spits out at me every time I try to build the empty project (posted above) to figure out what exactly I need to fix? For example - I see a lot of text regarding Post-Processing (e.g. UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/BeeBuildPostprocessor.cs:604) ... maybe it has something to do with that? Also, are there any resources that will help me to better learn all of this backends stuff (a basic YouTube/Google does not yield anything too concrete).

    "Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly."

    Where is this documentation located? I am not very familiar (or "good" with) the backends Unity file management stuff, so this is a mystery to me. Clicking on the Unity project folder yields several folders such as Library, Logs, Project Settings... etc. Is this the documentation you are talking about? Once again, recommendations for any online resources (like YouTube tutorials) to help me better understand this stuff would be awesome!

    Once again thank you so much for your response Kurt! Trying to get better at game development slowly but surely :D:D:D:D:D:D:D:D:D
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    37,136
    Yes.

    But get a blank project building first.

    If you can't do that, try other versions of Unity.

    If a blank doesn't build, nothing else will.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,521
    Can you attach the editor log?
     
  6. BrainAndBrain

    BrainAndBrain

    Joined:
    Nov 27, 2014
    Posts:
    115
    Running into the same issue: Unity 2021.3.23f1 (Apple Silicon) on macOS Ventura 13.2.1 can't build a blank project created using the 2D template. I'm on an Apple M1 chip.

    Editor gives me the following errors:

    Code (CSharp):
    1. Building /Users/david/Desktop/Build Test.app/Contents/MacOS/Build Test failed with output:
    2.  
    3. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)
    4.  
    5. BuildFailedException: Incremental Player build failed!
    6. UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/BeeBuildPostprocessor.cs:604)
    7. UnityEditor.OSXStandalone.OSXDesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/PlatformDependent/OSXPlayer/Extensions/Managed/OSXDesktopStandalonePostProcessor.cs:117)
    8. UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:28)
    9. UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
    10. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)
    11.  
    12. Build completed with a result of 'Failed' in 9 seconds (8811 ms)
    13. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)
    14.  
    15. UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
    16.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ce] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPlayerWindowBuildMethods.cs:194
    17.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95
    18. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)
    19.  
    20.  
    Any help would be appreciated!
     
  7. BrainAndBrain

    BrainAndBrain

    Joined:
    Nov 27, 2014
    Posts:
    115
    I was just able to successfully build the exact same project using Unity 2021.3.24f1 Intel. The error seen above seems to be a bug with the Apple Silicon version of the Unity Editor.
     
  8. BrainAndBrain

    BrainAndBrain

    Joined:
    Nov 27, 2014
    Posts:
    115
    Interesting. I was able to build the scene with Unity 2021.3.24f1 Apple Silicon as well. Maybe whatever this bug is was present in 2021.3.23f1, and is resolved in .24.
     
  9. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    381
    Thank you! That was it for me too!