Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

missing UnityEngine.UI

Discussion in 'Editor & General Support' started by dedefac96, Aug 28, 2019.

  1. dedefac96

    dedefac96

    Joined:
    Sep 18, 2018
    Posts:
    15
    Hello,
    i have a visual studio code project in c#. This project is used in all my unity projects (i set them the .dll).
    This VSC project needs UnityEngine.dll, UnityEngine.UI.dll that i took from unity 2018. Now i want to updgrade my vsc project with unity 2019.2.2f1 but UnityEngine.UI.dll doesn't exist anymore, how can i do ? i tried to keep the old UnityEngine.UI.dll in my vsc project, which i could successfully generate the dll but when i insert my vsc dll in my unity project with unity 2019.2.2, i get an error which say that i can't use UnityEngine.UI in my vsc project.

    I have see about the asmdef but this is not a file i can include in my vsc project isn't it ?

    Thank you.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    11,191
    Starting in Unity 2019.2, the UI component has been moved into Package Manager. Not sure if that helps to answer your question though.
     
    nikolay_i and Stizeeven like this.
  3. Vectorbox

    Vectorbox

    Joined:
    Jan 27, 2014
    Posts:
    226
    I also have VS library projects which require a Unity UI reference. Surely this situation was considered before making the decision ?.
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    2,744
    UnityEngine.UI.dll still exists, but it comes from package, check Packages\manifest.json, you should have an entry

    "com.unity.modules.ui": "1.0.0",

    Assuming you keep your VS project at the root of Unity project, the reference is done like this

    <Reference Include="UnityEngine.UI">
    <HintPath>Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
    </Reference>
     
  5. Vectorbox

    Vectorbox

    Joined:
    Jan 27, 2014
    Posts:
    226
    Thanks Tomas, I'll check it out.
     
  6. selkeer

    selkeer

    Joined:
    Sep 20, 2017
    Posts:
    7
    Thank you for your help. My vsc project is build in its own directory then a dll is created that I put in my unity project so I can't get the Unityengine.ui.dll this way. I tried to just set the unityengine.ui.dll of an empty unity project in my vsc project but I have error which tell me that the ui dll need others dependancies. Im currently trying to set them in the csproj
     
  7. Vectorbox

    Vectorbox

    Joined:
    Jan 27, 2014
    Posts:
    226
    This is my preferred method too, so it seems I'd have to adapt to the new system. As my existing libraries will be incompatible, I might just stick with version 2018.
     
    VoodooAssets likes this.
  8. MaxUnity111

    MaxUnity111

    Joined:
    Mar 25, 2019
    Posts:
    11
    Hi, I’m doing this recently. You can read more about where and how


    <Reference Include="UnityEngine.UI">
    <HintPath>Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
    </Reference>[/QUOTE]
     
  9. Bmco

    Bmco

    Joined:
    Mar 11, 2020
    Posts:
    4
    I just figured out the problem for me (this is a repost from a similar thread, hopefully it helps)…

    I was separating my project into different assemblies (creating a .asmdef file) and suddenly lost all my UnityEngine.UI references...

    Currently using 2019.3.0a3.

    If you look through the Packages folder there is : Packages\Unity UI\Runtime\Unity.ugui.asmdef

    I was looking for UnityEngine.UI and it wasn't there. However, if you add a reference to Unity.ugui in the references section of your .asmdef file, then in your scripts, the code "using UnityEngine.UI" works!
     
  10. zdlzyw_unity

    zdlzyw_unity

    Joined:
    Dec 25, 2018
    Posts:
    1
    just close vscode, remove visual studio code editor from window - package manager , then reinstall ,ver1.2.0+
     
  11. Imperial-Dynamics

    Imperial-Dynamics

    Joined:
    Oct 18, 2019
    Posts:
    13
    Easy solution that works 100%:

    go to Edit > Preferences > External Tools make sure the 'Generate all .csproj files.' is checked

    close Unity
    delete all csproj and sln files in your folder
    open Unity
     
    Black_six likes this.
  12. MaxIzrinCubeUX

    MaxIzrinCubeUX

    Joined:
    Jan 13, 2020
    Posts:
    5
    This fixed it for me:
    https://stackoverflow.com/a/60763699/3249250

    Add the following reference to UnityEngine.UI in the "Assembly-CSharp.cproj" at the root of the project.

    <Reference Include="UnityEngine.UI">
    <HintPath>Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
    </Reference>
     
    Lotramus likes this.
  13. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,298
    Most of the recent answers are for a differnet problem, which really doesn't help.

    Right now the problem still appears to exist: Unity has messed-up the packaging of the UnityEngine.UI.dll for years, and it's simply not possible to create DLL's of anything that references UI.EventSystems - because they're missing.

    I've just spent the last couple of hours trying to find a working version of that DLL (Unity broke it sometime in 2018.x / 2019.x) and use it to continue building DLLs, but I'm going round in circles. This has worked for me before, and all other references (many different Unity modules, including UI, including IMGUI, including Physics, etc) are all working - but the EventSystems is just missing from everything.

    Is this still broken? Is EventSystems still gone from the UnityEditor, with no replacement?
     
  14. In2Play

    In2Play

    Joined:
    Apr 25, 2016
    Posts:
    48
    Any solution to this problem yet?
     
  15. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    2,744
    UnityEngine.UI.EventSystems at least in 2019 lives in com.unity.ugui package, but it lives not in a form of a dll, but in a form of asmdef. So if you're using asmdef as well, it should be trivial for, simply add a reference towards UnityEngine.UI asmdef file.
     
  16. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,298
    How could asmdefs (Unity's proprietary system) in any way solve this problem? They have nothing to do with DLL compilation.

    Here's what worked for me and allowed me to continue development (note how old a version of Unity you need! Because Unity broke this and took a looong time to fix it)

    "Unity-2018.3.8\Editor\Data\UnityExtensions\Unity\GUISystem\UnityEngine.UI.dll"

    ...however I believe they eventually fixed this, sometime in 2020 (?), and now you can do it with:

    "2020.3.2\Editor\Data\Managed\UnityEngine\UnityEngine.UIModule.dll" -- I am not 100% certain that "UIModule" is the same as "UI", I seem to remember that for at least a few major versions UIModule was built/shipped incorrectly by Unity and was missing some of UI -- but if I remember correctly it now has all the code that was supposed to be in there and got deleted sometime in 2018.
     
    In2Play likes this.
  17. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    2,744
    UnityEngine.UIModule.dll is a wrapper assembly for communicating with native part of Unity Engine, the EventSystem lives in com.unity.ugui package, UnityEngine.UI asmdef file.

    I think I understand the problem - asmdef files ultimately are compiled into dlls, which are placed in <UnityProject>Library\ScriptAssemblies, so you can probably use Library\ScriptAssemblies\UnityEngine.UI.dll to compile your dll. Though that may be a bit risky, since that dll might be recompiled depending on the active platform set in Unity, but as long as you dont you use any code which is wrapped around defines, you'll be probably be safe.
     
  18. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,298
    Or ... we can do the correct thing: use the old version of the DLL until Unity fixed their build bug and started exporting the DLL again (as required).

    Checking a few more Editor versions, I was able to find the DLL in 2019 onwards, but the new one requires including the UIModule DLL manually *in addition* (never needed before, presumably for the reasons @Tomas1856 describes above - the Unity team split some of UI.dll into UI.dll and into a second DLL) for builds to work.

    So, TL;DR:

    1. Either use an old UnityEngine.DLL (Which contains 'all of Unity except for UI') together with the old UI DLL (before Unity broke the Editor), which only exists up to approx 2018.3 (but works fine in newer versions of Unity), located where I described above
    2. Or use the new UI DLL (doesn't exist until approx 2019.1), which requires you to ALSO use the UIModule DLL and manually remove any "UnityEngine.dll" you were previously using and instead manually add all the mini-DLL's for all Unity features you're using anywhere (and you will *probably* need to add the newer UnityEngine.dll too - although if you try to add an old 'mega UnityEngine dll' it will cause build conflicts and fail).
     
  19. Mizhael

    Mizhael

    Joined:
    Jul 15, 2015
    Posts:
    5
    oh boy... i got this problem and i have hours trying to figure it out what is happening
    upload_2021-5-27_1-21-55.png

    im using 2020.3.9f1 and suddently my textmeshpro stopped rendering when i check the references in the code they were marked as yellow

    now im desperate, i tried to reinstall the same version of unity and different solutions from this thread but nothing seems working

    is there a way i can re-import these dlls?
     
    MaxIzrinCubeUX likes this.
  20. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,298
    Are you making DLLs? If no: you have a different problem, this thread isn't the one you're looking for.
     
  21. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    2,744
    You could delete the Library folder (close Unity first), and see if that helps.
     
    a436t4ataf likes this.
  22. Black_six

    Black_six

    Joined:
    Dec 8, 2020
    Posts:
    1
    It works for me. Thanks~
     
  23. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    89
    I found unityengine.ui.dll in.
    C:\Program Files\Unity\Hub\Editor\2018.4.36f1\Editor\Data\UnityExtensions\Unity\GUISystem
     
unityunity