Build completed with a result of 'Failed'

Hi guys,
I have a weird problem with Unity. Sometimes my android build fails with this:

Error building Player: 2 errors

Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

I said sometimes because the editor fails to create the apk 1 times every 5-6 times. I donā€™t know why. Sometimes it creates the build and sometimes it doesnā€™t. After a failed build if I try to build again it works.
The console says 2-3 errors but there no others informations. What are these errors?

Using Unity 2017.4 LTS + windows 10
(I had this problem since unity 2017.3)

Hi!
The actual errors are usually above this one in the console.

4 Likes
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.InspectorWindow.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:147)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:168)
UnityEditor.AssetDatabase:Refresh()
Google.PackageManager.ProjectManagerController:EnsurePluginsDirectory()
Google.PackageManager.ProjectManagerController:.cctor()
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

What does is mean? (canā€™t open with the dobule click)

I donā€™t have this error with the gameplay in the editor

If I try to double click on it I have this in inspector:
3490869--277953--upload_2018-5-9_17-3-14.png

1 Like

This error is unrelated and a fix is going to appear in a later version.

ā€œError building Player: 2 errorsā€ might mean, for example, that you have compilation errors in your scripts, which you have to fix before running on a device.

1 Like
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

My scripts work fine in Standalone and Editor. For the moment I will believe that restarting unity will fix this problem. I doubt it. 2019.3.f. this was trying an UWP build with IL2CPP backend,and .NET 4.0

1 Like

thatā€™s your answer Unity? really?

7 Likes

More info in Editor.log

hello for me it was enough to restart the PC

Build completed with a result of ā€˜Failedā€™
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Anyone here to help about how to erase this error.

3 Likes

Build completed with a result of ā€˜Failedā€™
UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

3 Likes

Build completed with a result of ā€˜Failedā€™
UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr)

1 Like

Anyone here to help about how to erase this problem?

1 Like

Build completed with a result of ā€˜Failedā€™
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

iā€™ve been stuck with this problem suddenlyā€¦even though it successfully ā€œbuildā€ but cant even use the apk to publish. it says not a valid apk files.

3 Likes

When you click build, try to select a different folder (other than your project folder) when prompted to select a build folder.

1 Like

Hi Guys if you guys havenā€™t find the solution I had the same problem so my solution was to remove all the irrelevant scripts that I did not need in my project since I added a prefab that was not mine.

(So I am making a marker base app using Vuforia and I needed a prefab from an ARCore based project and that came with some error [Build completed with a result of ā€˜Failedā€™ UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)]
so to solve that I looked at all the ArCore scripte that I did not need{Like ARanchor, arcoreInterface and so onā€¦} and I deleted them My project worked just fine after that)

I hope this can help
I am note an expert :wink:

I manage to fix my problem. Just reinstall the old version of Unity and old version of Android Studioā€¦just go back 2-3 versions.

Restarting Unity did not help but restarting my PC helped me to solve this issue.

1 Like

The Solution isā€¦

Build the application outside the Assert folder.

Build ā†’ Create New Folder (For Instance, App) ā†’ Select Folder.

2 Likes