Build game error (3 error).. [SOLVED]

EDIT 2: I did solve it, the problem was with the Scene, but I don’t know exaclty why… but I did drag all my objects to a new scene, and added that to the build settings instead and worked!

Hello! Soon I’m finished with my game, but now after I got the latest version of Unity 2017.1, I getting error… This have never happend before when I have tried Build my game and test it.

Here is the error:

EDIT: Here is some error text from Unity Console:

An asset is marked with HideFlags.DontSave but is included in the build:
Asset: ‘Library/unity editor resources’
Asset name: DefaultHDRI
(You are probably referencing internal Unity data in your build.)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

Here is error 2:

Building - Failed to write file: sharedassets2.assets
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

Error 3:

UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

I have tried to delete the c# files and .vs folder, but still not working.

Solved how? I just ran into this same bug, and yours is the first search result. I wish you’d taken the time to explain how you fixed it.

EDIT: Oh, I see, you edited it at the top (I was skimming quickly and missed it, expecting a reply). Hm. Still a mystery then.

If you’re using source control and try to merge a YAML file (scene or prefab or scriptableObject), this might happen if the merge silently succeeds, leaving behind damaged YAML. At that point, back up to one side of the merge or the other, pick it, then reapply to the best of your ability the actual things that were going to get merged, and discard the damaged merge artifact.

1 Like

Ah, actually I found the answer in another thread . Turns out the culprit is in the Lighting Settings, where the Environment Reflections somehow got set to DefaultReflectionForPrefabMode. Apparently that is some built-in cube map that should have been named BreakMyProjectSoBuildFailsWithAMysteriousError.

Many people on the net who have run into this have solved it by creating a new scene and moving their content over, thinking the original scene was “corrupted” — but probably the only issue was the lighting settings, and fixing that would have done the trick too. It certainly did in my case.

1 Like

Years later and I ran into the same thing. This is what fixed it for me. I just went into the lighting settings and under the “Environment” tab there is a “Cubemap” setting. I just deleted that and it worked.