Search Unity

Unable to build the project!

Discussion in 'Scripting' started by elmar1028, Jul 25, 2016.

  1. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    Hi,

    I am trying to build the project into a Web GL, but it throws 3 errors when it reaches the "Building additional assets" stage.

    Things to note:
    • I do not use NGUI or any other third-party GUI solution, but Unity's new UI system
    • I have tried versions 5.2.3 and higher and it still has returned me errors
    • I have one DLL LitJson that is used to parse JSON files
    • Project includes StreamingAssets and Resources folders
    • Error occurs even if I try building on other platforms such as Windows. Same errors are returned
    • I am using a font downloaded online
    • Blacksmith's Character "Challenger" is also included
    • I thought the project folder has been corrupt so I decided to migrate all assets to a clean project. No changes
    Any idea how do I fix these?

    Thanks in advance!
     
    smock_74 likes this.
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    You have any UnityEditor code references in your scripts? because thats a nope. You will need to define those out for your compiles. Annoying yes.
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    wrap your editor stuff in #if UNITY_EDITOR
     
    TaleOf4Gamers and JamesLeeNZ like this.
  4. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    I have discovered the issue was related to an editor extension code I made.

    My editor code is located inside of an "Editor" folder, which is supposed to not compile into the final build. To be sure, I wrapped all editor scripts into #if UNITY_EDITOR. Problem still persists.
     
    levlaj likes this.
  5. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    Make sure you don't have
    Code (csharp):
    1.  
    2. using UnityEditor;
    3.  
    in any scripts included included in the build
     
    Kiwasi likes this.
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    It's not the editor script that is likely the problem. It's likely some other script outside your editor folder that references the editor script.
     
  7. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    lol getting the same damn error now... at first it was being caused by a shader, but I finally got sick of recompiling that so deleted it. problem went away, now its back, but I have no idea whats driving it. Pretty sure I don't have any Editor references.

     
  8. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    I had this error because there was a "Resources" folder, that stored all my skin items and sprite UI. Problem went away after I renamed it.
     
    fadizant, salientpl, Morrag and 2 others like this.
  9. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    yeah going to look at alternatives to resources.
     
  10. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    OK! so it turns out, if you enter play mode and build, you will get this problem.

    If you have not entered play mode, it will build continuously without issue.

    Only way to fix is restart Unity
     
  11. levlaj

    levlaj

    Joined:
    Apr 11, 2017
    Posts:
    1
    @JamesLeeNZ I have the same issue: if I enter play mode and do a few things before making a build, I always get the following 2 errors:
    and
    Then running the build fails with the error
    and doesn't give any more information.

    I stripped the application of many plugins, components, and functionality it had, and I still get the same errors.

    These are some things I tried:
    - remove as many plugin DLLs as possible
    - remove as much System.Thread related as possible
    - surround everything that uses UnityEditor with #ifdef UNITY_EDITOR / #endif
    - remove any postprocessors
    - step-by-step remove from GraphicsSettings custom, legacy, and all shaders from always included shaders
    - remove custom shaders
    - in the Player settings disable auto-graphics API for Windows and set OpenGL for the application
    - remove guiskins
    - set shader stripping to manual and not stripping anything

    Do you or anyone know what could be the cause of this issue? The project was upgraded from Unity 4 to Unity 5, maybe that causes the problem?

    My real concern is that I don't know what is causing it, so it might hide a bigger issue that will only appear to users (I'm developing a commercial non-game application).
     
  12. xxsjdy

    xxsjdy

    Joined:
    May 10, 2018
    Posts:
    1
    OMG I SOLVED my problem! THX !!
     
  13. leoloveaili

    leoloveaili

    Joined:
    Apr 8, 2015
    Posts:
    1
    [QUOTE =“xxsjdy,帖子:3491523,成员:1810924”] OMG我解决了我的问题!THX !! [/ QUOTE]
    How did it ???
     
  14. Eldoir

    Eldoir

    Joined:
    Feb 27, 2015
    Posts:
    60
    Hello,
    For me the problem was probably that I was running out of space on my disk.
    I deleted some files to get 1-2 GB more, tried to build again, and it worked.
    If it can help!
     
  15. Raeion

    Raeion

    Joined:
    Jul 5, 2016
    Posts:
    38
    I'm having the issue but with a slight difference

    An asset is marked with HideFlags.DontSave but is included in the build:
    Asset: 'Library/unity editor resources'
    Asset name: DefaultReflectionForPrefabMode

    What on earth is DefaultReflectionForPrefabMode ????
    I googled it but it seems it doesn't exist anywhere on this planet !!
    Every time I try to build it failed when it reaches the sharedasset0 and prompts this error.
     
  16. peacefulshade

    peacefulshade

    Joined:
    Jul 25, 2012
    Posts:
    12
    Had this error in Unity 2018.3.1f1 and solved it by closing Unity, deleting the library and obj folders and restarting
     
    Lapsapnow likes this.
  17. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    I am having this issue too. Precisely with reference to "Asset name: DefaultReflectionForPrefabMode".
    Would be grand if someone can figure it out...
     
    Lapsapnow likes this.
  18. Raeion

    Raeion

    Joined:
    Jul 5, 2016
    Posts:
    38
    I finally figured it out what the issue was with DefaultReflectionForPrefabMode after spending a full day on it.
    So I went back in time and checked out all my previous repository commits to see where did it actually started to fail. and noticed on my last push that some scene changes were the only true change. so it hit me to just move everything I have in the scene to a new scene and boom it worked ! so Unity just wanted to mess with the scene !
    Easy way is to Create a new scene, then grab the corrupted scene into the new one, move everything from there to the new scene then close and don't save the old scene !
     
  19. _M_S_D_

    _M_S_D_

    Joined:
    Nov 12, 2013
    Posts:
    511
    Thanks! :D I just found this too. Luckily, I don't have many scenes and no baked lighting. :)
     
  20. KrzysiekDev

    KrzysiekDev

    Joined:
    Jan 7, 2016
    Posts:
    2
    I had the same problem, I removed all elements from the scene and removed all scripts, unfortunately the problem was all the time. I compared the scene file with the clean scene and it turned out that the problem was with the lights, it was enough to reset all settings in the light settings and the project could be built without errors
     
  21. KarimTA

    KarimTA

    Joined:
    Jan 8, 2019
    Posts:
    27
    Hey guys, we encountered the issue with the DefaultReflectionForPrefabMode on our side.

    No idea why, but a Unity Editor asset got referenced in our scene's Lighting Settings.
    Only thing we are sure of is that we didn't put it there, it appeared in a commit where a level designer changed unrelated things.

    You can fix it without recreating the scenes by removing the reference to the Unity asset here:

    Unity-Bug.png Unity Bug 2.png
     
  22. abhijeet1001

    abhijeet1001

    Joined:
    Jan 6, 2015
    Posts:
    65
    this worked for me !! thanks for sharing it.
     
    KarimTA likes this.
  23. firestorm185

    firestorm185

    Joined:
    Sep 23, 2014
    Posts:
    24
    @Raeion you deserve a medal dude! I've been trying to fix this issue for hours with no avail! Dragging all my scene content into a new scene fixed it right up!
     
    Raeion likes this.
  24. Raeion

    Raeion

    Joined:
    Jul 5, 2016
    Posts:
    38
    Oh man. I found so much help on forums I thought to give some back <3
     
  25. firestorm185

    firestorm185

    Joined:
    Sep 23, 2014
    Posts:
    24
    Thanks for giving back, has little saved my entire project!
     
    radiantboy and Raeion like this.
  26. Deleted User

    Deleted User

    Guest

    Mann, thank you a lot, you saved my entire project.All the problem was "Resources" folder.
     
  27. Morrag

    Morrag

    Joined:
    Mar 10, 2013
    Posts:
    6
    THIS! Thank you!
     
  28. amit-chai

    amit-chai

    Joined:
    Jul 2, 2012
    Posts:
    80
    This worked for me as well! thanks@!!!!!!!!
     
    Raeion likes this.
  29. wlwl2

    wlwl2

    Joined:
    Jun 17, 2018
    Posts:
    29
    I think that upgrading the "Universal RP" package from 7.3.1 (2019.4 verified) to 7.5.1 caused the issue for me. I'm using Unity 2019.4 right now. Maybe it was because I accidently changed the official Light2D script (but I don't think it's this). Now I'm changing all my packages to "2019.4 verified".

    To fix the issue, you have to change the "Environment Reflections" Source to Custom, and Cubemap to "None (Cubemap)". I tried the fix @KarimTA suggested and it works, but I first tried changing source to Skybox which doesn't work. I guess Universal RP automatically set this.
     
  30. creativeDna

    creativeDna

    Joined:
    Oct 12, 2020
    Posts:
    1
    you guys just saved my time. I encountered this error just one hour before writing this post. Thank you
     
  31. deenasty

    deenasty

    Joined:
    Nov 17, 2017
    Posts:
    3
    I love you guys, this issue droves me crazy. Thank you @KarimTA & @wlwlz changing the "Environment Reflections" Source to Custom is what made for me. Thank for your help
     
    JoeStrout likes this.
  32. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    We ran into this bug today, the day before an important demo for potential investors! You saved our bacon. Thank you very much!
     
    KarimTA likes this.
  33. miracletechteam1

    miracletechteam1

    Joined:
    Sep 18, 2019
    Posts:
    24
    We have the same problem, but not same error.
    Maybe will help someone who have same issues/problems like this:
    Code (CSharp):
    1. An asset is marked with HideFlags.DontSave but is included in the build:
    2. Asset: 'Library/unity editor resources'
    3. Asset name: Folder Icon
    4. (You are probably referencing internal Unity data in your build.)
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Code (CSharp):
    1. Building - Failed to write file: 0000000000000000d000000000000000
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    It's because one (maybe more) prefab referencing it (the left one)
    upload_2021-6-10_12-1-55.png
     
  34. zghc84

    zghc84

    Joined:
    Jan 23, 2021
    Posts:
    2

    Oh. My. God! Thanks, this has been bugging me for sooooo looong.
     
    Raeion likes this.
  35. ega881124

    ega881124

    Joined:
    Dec 1, 2020
    Posts:
    1
    it worked for me !! thanks a lot
     
  36. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Is there any way to stop this DefaultReflectionForPrefabMode thing from being created? This error pops up for me intermittently and it's really annoying and time consuming sifting through every scene and find which one has auto added this file.
     
  37. PiscesStudios

    PiscesStudios

    Joined:
    Nov 19, 2016
    Posts:
    71
    Yeah this worked. I created a new scene, copied all the objects from the old scene. The new scene compiles.

    After testing the standalone and crashing, I think I now know why the scene couldn't originally compile. One of my objects had a type mismatch in the inspector. No crash now.
     
    Last edited: Oct 15, 2022
  38. henryqng

    henryqng

    Joined:
    Jan 17, 2017
    Posts:
    9
    All these fixes are bandage solutions. Unity keeps saying we AI this and AI that, what they need to do is to focus on making the Unity compiler more intelligent in pinpointing where the root of the problems occurred.
     
  39. salientpl

    salientpl

    Joined:
    Apr 21, 2023
    Posts:
    2
    As crazy as it might sound renaming the folder solved all my problems lol. Thanks for the tip!