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. Dismiss Notice

UnityEditor.dll assembly is referenced by user code, but this is not allowed

Discussion in 'Addressables' started by Lex4art, Apr 29, 2021.

  1. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    I've run into the problem with new Unity 2021.2a14 and up: if scripting backend is set to IL2CPP and those new addressables (v1.17.17) are used to store at least one object with script (any script, even empty default one) - project won't build (at least for Windows platform x64) because of error 'UnityEditor.dll assembly is referenced by user code, but this is not allowed'. This was tested on fresh empty project without any scripts from me.

    Bugreported as Case 1332720
     
  2. hexdecc

    hexdecc

    Joined:
    Oct 24, 2014
    Posts:
    141
    any solution?
     
  3. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Fixed in Unity 2021.2.0a16 and up.
     
  4. Miguelfanclub

    Miguelfanclub

    Joined:
    Jun 14, 2015
    Posts:
    51
    Still hapening in 2022.1
     
    Meatloaf4 and JuanMaldonado like this.
  5. mpistella

    mpistella

    Joined:
    Jan 30, 2017
    Posts:
    3
    Still Happening in 2022.1.3f1
     
  6. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    470
    Still Happening in 2022.1.4f1 ! iOS build
    Android is fine...
     
    Last edited: Jun 15, 2022
    Meatloaf4 likes this.
  7. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    470
    hello,
    well the issue still exist....
    OS Mac Silicon: 2022.1.5f1
    but only for me on iOS

    Android works fine:
    Build completed with a result of 'Succeeded' in 32 seconds (31662 ms)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)


    iOS:
    UnityEditor.dll assembly is referenced by user code, but this is not allowed.
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

    BuildFailedException: Incremental Player build failed!
    UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs:634)
    UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/iOSBuildPostprocessor.cs:508)
    Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/iOSBuildPostprocessor.cs:515)
    UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/bokken/buildslave/unity/build/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/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

    i'll don't believe that UnityEditor.dll assembly is referenced by user code...
    if so why does the Android build not fail with same error?

    M.
     
  8. heitorzorah

    heitorzorah

    Joined:
    Mar 18, 2020
    Posts:
    17
    Getting the same error with WebGL build. Unity version 2022.1.5f1.
     
  9. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    736
    Hey all, anyone that's experiencing this issue please fill out a bug with Unity. The original ticket posted appears to be closed. From what I'm seeing in these posts I think the issue is either a build pipeline related one, or platform specific issues. Possibly a little of each. I don't think the problem is actually Addressables in this case, I think we may just be hitting a bug in the engine. I apologize for not being able to be more help.
     
  10. DeathPro

    DeathPro

    Joined:
    Jul 28, 2018
    Posts:
    69
    If you have .asmdef files, make sure to only mark the Editor field for Editor Scripts which is generally in Editor Folder.

    I have this issue then I edit .asmdef files accordingly Editor sides. It worked. You should not have any Editor Scripts on Runtime.

    I had these errors!
    DOTween_AddressablesBuildError.PNG

    If you have DOTween package in your project. You can check the "Create ASMDEF..." to create .asmdef files properly for DOTween.

    DOTweenPanelOpen.png

    DOTweenCreateASMDEF.PNG

    DOTweenEditorASMDEF.PNG
     
  11. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    I tried for a while to manually edit the Asmdefs of plugins but nothing seemed to fix it. I had to give up and switch back to Unity 2021 for WebGL.
     
  12. josteos

    josteos

    Joined:
    May 12, 2017
    Posts:
    4
    I believe I'm getting the same problem, but only with Android builds. Worked great in 2021.2.19f. Works great for PC builds on 2022.1.x. But for android on 2022.1.x (tested just now with 2022.1.9f)

    UnityEditor.dll assembly is referenced by user code, but this is not allowed.
    UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions)
    SuperUnityBuild.BuildTool.BuildProject:BuildPlayer (string,SuperUnityBuild.BuildTool.BuildReleaseType,SuperUnityBuild.BuildTool.BuildPlatform,SuperUnityBuild.BuildTool.BuildArchitecture,SuperUnityBuild.BuildTool.BuildDistribution,System.DateTime,UnityEditor.BuildOptions,string) (at Library/PackageCache/com.github.superunitybuild.buildtool@5.0.4/Editor/Build/BuildProject.cs:439)
    SuperUnityBuild.BuildTool.BuildProject:performBuild (string[],UnityEditor.BuildOptions) (at Library/PackageCache/com.github.superunitybuild.buildtool@5.0.4/Editor/Build/BuildProject.cs:347)
    SuperUnityBuild.BuildTool.BuildProject:BuildAll () (at Library/PackageCache/com.github.superunitybuild.buildtool@5.0.4/Editor/Build/BuildProject.cs:30)
    UnityEditor.EditorApplication:Internal_CallDelayFunctions ()
     
    justin_unity842 likes this.
  13. mcfaddentjoe

    mcfaddentjoe

    Joined:
    Nov 8, 2019
    Posts:
    4
    Seeing the same issue on 2022.1.10f, in my case only on iOS builds. Android works fine, and both platforms built fine on 2021.3.5f1. Any updates on a fix, or failing that a workaround?

    UnityEditor.dll assembly is referenced by user code, but this is not allowed.
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

    BuildFailedException: Incremental Player build failed!
    UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs:634)
     
    Meatloaf4 likes this.
  14. g0983230881

    g0983230881

    Joined:
    Jul 18, 2021
    Posts:
    1
    In my case, as I create a custom font asset with chinese, I only drag a font file from web into unity, and use it with TMP, then I build, the same exception just happen below.
    "unityeditor.dll assembly is referenced by user code, but this is not allowed. unityengine.guiutility:processevent (int,intptr,bool&)"
     
  15. bn-l

    bn-l

    Joined:
    Aug 27, 2022
    Posts:
    7
    Happening on 2021.3.8f1--the current LTS that unity hub prompted me to install by default. This exact error as OP when I try to build for WebGL:

    UnityEditor.dll assembly is referenced by user code, but this is not allowed
     
    Last edited: Sep 17, 2022
  16. IRHappyHippo

    IRHappyHippo

    Joined:
    Sep 20, 2021
    Posts:
    7
    Happening with
    upload_2022-9-2_4-16-1.png

    if i build with mono it builds and runs great but with il2cpp i get this error
     
    justin_unity842 likes this.
  17. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    746
    I'm building with MONO in 2022.1.15f1 and it's still happening.

    I managed to get one build out of it, I wish I recorded what I did but roughly it was. Delete all editor folders in the project, delete ScriptAssemblies, delete Library/Bee, delete Library/BuildPlayerData, reset editor.

    Haven't been able to get a build work in the last 24 hours since though
     
  18. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    746
    Disabling assembly stripping got the build to work again. Will put everything back to normal and see if it still works.
     
  19. josteos

    josteos

    Joined:
    May 12, 2017
    Posts:
    4
    A workaround that appears to be working for me is to switch Odin Inspector into Editor Only mode. I'm not using Odin serialization, so this is fine for me.
     
  20. Mr-Frost

    Mr-Frost

    Joined:
    Oct 10, 2014
    Posts:
    6
    Hey. This happened to our project as well when we migrated from 2021 LTS to 2022.1.14f1 recently. We had the same error when building for Android or iOS with IL2CPP. Project is 2 years in development and we never had this error before. Downgrading back to 2021 LTS fixes the problem. Any version of Unity 2022 has this bug, including 2022.2

    Nothing from suggested above worked for us.

    After some research, it turned out that this error was caused by Odin Inspector plugin. I just created an empty project, added Odin Inspector from the asset store and tried to build IL2CPP and got the same error.

    I reached Odin Team in hope of some clarification. They replied that it seems to be a Unity's bug. Editor ignored platform settings for libraries and tried to link plugin's editor dll instead of designed for IL2CPP. Someone in the chat also mentioned that they have similar issues with some XBox plugin as well, but I can't confirm it.

    This is all I've found out. I intend to file a bug report later on. But right now we decided to downgrade to 2021 LTS because we need IL2CPP.
     
    masterton likes this.
  21. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    364
    I have the same error with 2022.1.20.
    When I downgrade to 2021.3.11 the error is gone.

    Fun fact:
    The project I tested is a small test project which is a subset of a much larger project.
    The larger project does build with 2022.1.20.
     
    justin_unity842 likes this.
  22. hexdecc

    hexdecc

    Joined:
    Oct 24, 2014
    Posts:
    141
    I made exclude platform iOS from world creator .dll fileses and problem solved.
     
  23. Eatton

    Eatton

    Joined:
    Jan 16, 2019
    Posts:
    8
    I am having this problem too. Everything builds fine in 2020.3.27f, but when I attempt to use 2022.1 I get the following error:

    UnityEditor.dll assembly is referenced by user code, but this is not allowed.
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

    BuildFailedException: Incremental Player build failed!
    UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/BeeBuildPostprocessor.cs:634)
    UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:28)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <000e80cd09d6452384f1ee06866e29a3>:0)
    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/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)


    I have spent 2 days on this, trying everything listed on the thread so far and also uninstalling Appodeal SDK and the Odin SDK, but to no avail. I also tried it in the 2022.2 beta but still no luck.

    I am building for Android only. Has anybody solved this using a method not listed above?
     
    bn-l likes this.
  24. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    182
    Also having this issue :( Exact error as @Eatton but only iOS fails for me.
     
    bn-l likes this.
  25. StudioEvil

    StudioEvil

    Joined:
    Aug 28, 2013
    Posts:
    66
  26. hexdecc

    hexdecc

    Joined:
    Oct 24, 2014
    Posts:
    141
    the problem based on a specific dll it should be excluded from build,but unity does not say it which dll from.
     
  27. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    191
  28. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    91
    Happening also in 2022.2.3f1.
     
  29. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    191
    The tracker says now "Fix In Review for 2022.2.5f1" so we need to wait for 2 more versions...
     
  30. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    91
    Yeah I saw, thanks. Two more version hey, that's a long time without a build.
     
  31. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    364
  32. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    191
    I love the bugs with "under consideration" for LTS and main versions but fixed in the alphas xD

    I confirm 2022.2.4f1 still has the bug :')
     
    Muckel likes this.
  33. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    91
    Still happening in 2022.2.4.f1. Getting closer....
     
    fcorbel likes this.
  34. brice_allinc

    brice_allinc

    Joined:
    Feb 9, 2022
    Posts:
    3
    Did anyone found a workaround instead of downgrading?
     
    Muckel likes this.
  35. Hypertectonic

    Hypertectonic

    Joined:
    Dec 16, 2016
    Posts:
    75
    It would be extremely nice if Unity actually gave a useful message like *where* editor is being referenced, so we could troubleshoot this.
     
    Muckel likes this.
  36. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    191
    It's something internal for sure. 2022.2.5f1 is up and it let me compile with IL2CPP now
     
  37. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    470
    nope... did everything... started from scratch... imported one bone to wich script or asset make the trouble...
    because Unity doesn't care much... also the error message is stupid... gives no clue what is wrong...
    we all gave up on this.... back to LTS version...
    but that makes also trouble on Mac OS X ... Unity doesn't care much anymore.... .-(
    see the Unity Hub ... bloatware
     
  38. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    191
    It's working for me on MacOS ventura (Apple Silicon M1) and 2022.2.9f1 but yeah, it sucks it is an internal bug.
     
    Muckel likes this.
  39. unity_1gbKoMUCLqMcmQ

    unity_1gbKoMUCLqMcmQ

    Joined:
    Sep 3, 2021
    Posts:
    1
    I switched from version 2022.2.4f1 to 2022.2.12 and now it is working :)
     
  40. JeisyLiu

    JeisyLiu

    Joined:
    Jul 8, 2020
    Posts:
    1
    I GOT ONE OF THE REASON WHY IT HAPPENS:
    if you are using il2cpp build on Windows then just moved some external .NET dll in the Plugins folder. DON'T FORGET to drag in these dll required dependencies and references dll as well.
     
  41. PeraSite

    PeraSite

    Joined:
    Jul 3, 2020
    Posts:
    4
    What do you mean by " DON'T FORGET to drag in these dll required dependencies and references dll as well"?
    Can you explain more detail? I have some external .NET dll and having same problem.
     
  42. Michal_4D

    Michal_4D

    Joined:
    Aug 8, 2023
    Posts:
    3
    Hello. I have same problem with UNITY 2023.1.9f1.
    It is not possible to publish even extremely simple project to WebGL because of that error. It is desperate situation!

    Can anybody help us ?? :(
     
  43. ladellparks

    ladellparks

    Joined:
    Jul 28, 2021
    Posts:
    11
    I have this same problem but SAME PROBLEM

    System.Windows.Forms.dll assembly is referenced by user code, but is not supported on StandaloneWindows64 platform. Various failures might follow. UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
     
  44. Michal_4D

    Michal_4D

    Joined:
    Aug 8, 2023
    Posts:
    3
    Hello,
    oooh that error in Unity was driving me crazy. After many days of trying every suggestion, only one suggestion works for me. Someone somewhere mentioned that sometimes might help to delete LIBRARY folder in unity project.
    So I made a backup of that folder to be sure I will not loose my project and I simply deleted this folder (you need to turn off Unity first).
    After that, Unity automatically downloaded whole LIBRARY folder again and that crazy error has magically dissapeared. Good luck to you all !
    Maybe it will help you too.
    M.
     
  45. kim_me_ma_ro

    kim_me_ma_ro

    Joined:
    Oct 8, 2015
    Posts:
    4
    I got the answer but not a perfect one but can build.
    In my case I'm using world creator asset for level designing but when I finalized my work it reveals can't build with weird error that you guys talking about. I tried some other ways and I got the way find dll file and check on the checkbox that named 'Editor' under 'Exclude Platforms' under Select platforms for plugin. I thinks it causes various way so it might not work for your case. Just in case~ it cause editor error but Ignore and build is work.
    upload_2023-10-19_3-56-40.png