Search Unity

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

    Joined:
    May 2, 2017
    Posts:
    14,446
    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:
    232
    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:
    3,918
    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:
    232
    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
     
    Kreuzkuemmelll likes this.
  7. Vectorbox

    Vectorbox

    Joined:
    Jan 27, 2014
    Posts:
    232
    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:
    54
    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!
     
    Kreuzkuemmelll likes this.
  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:
    17
    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>
     
    elkmoradowitzky and Lotramus like this.
  13. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    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:
    66
    Any solution to this problem yet?
     
  15. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    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,933
    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:
    3,918
    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,933
    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,933
    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:
    3,918
    You could delete the Library folder (close Unity first), and see if that helps.
     
    Eon_2e and a436t4ataf like this.
  22. Black_six

    Black_six

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

    McSwan

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

    Kreuzkuemmelll

    Joined:
    Feb 14, 2018
    Posts:
    7
    This thread has been a gold mine for me. I have been trying to reference Unity libraries in my own libraries. But now there was an issue where Unity cannot find anything related to com.unity.ugui@1.0.0/Runtime/UI/Core or [...]/UI/EventSystem and UnityEngine.TestRunner/NUnit/Extensions
     
  25. PatateBarbare

    PatateBarbare

    Joined:
    Apr 24, 2021
    Posts:
    1
    Hi fawks, I had the same problem, could not access "using UnityEngine.UI" in Visual Studio.

    I found something that worked for me, hopefully it wont bring more problems further on. I'm pretty new into scripts and programming so you'll know better than me if it sucks or not.

    How I did : In visual studio, go in the Solution Explorer and look for "UnityEngine.UI". Here I found two lines called "UnityEngine,UI (déchargé)" : I guess in english it would be "UnityEngine.UI (unloaded)". Right clicked on the first one, and choosed the first option,something like "install missing components".

    Took me around 1GB but in the end I can now use "using UnityEngine.UI" in my Visual Studio.

    Hope it might helps. Let me know if for some reason it might lead to more problems.

    Cheers
     
  26. DigitalSalmon

    DigitalSalmon

    Joined:
    Jul 29, 2013
    Posts:
    100
    This thread is really quite painful. Most of the posts are either unrelated issues, or unrelated solutions.

    a436t4ataf is quite rightly pointing out that the ability to use UnityEngine.UI in an external DLL is utterly busted - All this nonsense about asmdef's and packages is completely unrelated, because we're not inside the Unity project.

    The generated DLLs have a ton of CoreModule dependancies, which completely destroys any hope of having a sensible dependancy setup in your class library.

    I'm going to have a go at stripping out all my UnityEngine.dll dependancies and move everything over to the "Module" versions of everything, with the full expectation of reaching a brick wall. Wish me luck.
     
  27. DigitalSalmon

    DigitalSalmon

    Joined:
    Jul 29, 2013
    Posts:
    100
    Nah. Totally unworkable.

    You can go down that "Include all the module dependancies" and have 12 dependancies, that's fine. But as soon as you also have a dependancy on a DLL that uses UnityEngine (Such as Odin, but there will be others) you're out of luck.

    I'm over it. Just gonna stop using DLL's and move to asmdef. Absolutely not an option for some, and has no options for hiding source, so it's a real shame this is totally stuffed at the moment.
     
  28. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    If you speak to the Odin folks you might be able to get a modular linked build from them - they're pretty helpful with this stuff.

    But yeah - if you have 3rd party dependencies your'e screwed. Just today Unity QA rejected my bug report that asmdefs VersionDefines is 100% broken against AssetStore packages, giving the excuse: the manual doesn't say it does work, so the fact it doesn't work isn't a bug it's a feature, and we reject this bug report. You can request a feature change.
     
  29. JaozimOperigozo

    JaozimOperigozo

    Joined:
    Apr 22, 2022
    Posts:
    1
    go to "Edit" > "Preferences..." and make sure your External Script Editor is set to open with Visual Studio.
    [Anexar=completo]1042436[/Anexar]

    AND

    then open visual studio with some "script" project and also check if everything is up to date within the solution manager.
    https://prnt.sc/RzIUSzRRbLAP
     

    Attached Files:

    Last edited: Apr 22, 2022