UnityEngine.UI Deprecated in Unity 2019.2

Hi All,

I have spent over 4 hours banging my head and keyboard on google trying to figure out why “using unityengine.ui;” doesn’t work anymore for Unity 2019.2. I found out it was deprecated. I did not know that and now I wish I didn’t upgraded to 2019.2 because the documentation for 2019.1 still has those coding references and 2019.2 doesn’t. I have read they have moved it as a package and some people are happy about it. But no one can tell me how to fix it is my main problem right now. That problem is how get access that library because the using statement doesn’t work anymore. Because they moved it to a package, I have been googling how to reference this package in my code but getting no where. No I am not using the Alpha or Beta Version.

Can anyone help please?

2 Likes
UI

Try this

2 Likes

I use old scripts that use UnityEngine.Ui without any problem. No error message, not warning about UnityEngine.UI being deprecated.

Creating new script using UnityEngine.UI is not a problem either; they work in 2019.2. The old 2018.3 documentation can still be used, I guess: https://docs.unity3d.com/2018.1/Documentation/Manual/UISystem.html.

It’s weird though that it has disappeared from the 2019.2 and 2020.1 pages. They must have been moved somewhere and nobody warned us.

2 Likes

I knew that was it. I managed to dig up an old post about that: Unity 2019.2 Is Now Available page-4#post-4931975

It’s here: Namespace UnityEngine.UI | Unity UI | 1.0.0

1 Like

I did a search in the project folder for the .asmdef file extension. But none reference the project name. only the following

Unity.com.unity.vscode.Editor
com.unity.ide.rider
UnityEditor.TestRunner
UnityEngine.TestRunner
Unity.CollabProxy.Editor
Unity.CollabProxy.EditorTests
Unity.TextMeshPro
Unity.TextMeshPro.Editor
Unity.TextMeshPro.Editor.Tests
Unity.TextMeshPro.Tests

Still back to square one unless you are not specific enough on your instructions or could be for an older version of unity.

Come On. You got to be serious. This is even happening in the 2019.3 Version.
I am getting really ticked off.

Unity Documentation doesn’t help.
Who has a clue?

I have no package namespace access to UnityEngine.UI

1 Like

Have been working with Unity 2019.2 on a daily basis since it was first released and I’m not having any of the troubles you describe here. Check the package manager for your project (Window → Package Manager). If there isn’t anything in the package manager then I’d suggest resetting your project’s packages by clicking Advanced → Reset Packages to Defaults.

Package Manager in Unity 2019.2

5248235--524195--upload_2019-12-5_1-15-15.png

Alternatively you can navigate to the packages documentation by going to the manual, expanding Packages in the side bar, and then expanding Built-in Packages. Click the one you want to check and then on the page that loads click the version. It’s totally convoluted.

1 Like

The Packages are installed for the project. Yeah Right. Which I have found out now. The Packages folder on each package is empty in the project folder. What unity is doing is getting it from another source not the project it’s self. Hench why the namespaces are not registering. Now this is a clean project from scratch for 2019.3 Full Release. So how to we go about fixing it as copy and pasting does some weird things to the packages say it is not for production use. Anyone have this issue?

Although some users may find the change useful (?), it doesn’t really help when creating libraries in Visual Studio which, out of preference, I’ve always installed as a separate entity

This doesn’t really help fix the problem.

Had same issue with missing UnityEngine.Ui namespace.

This workaround here – changing csc to csc.exe – worked for me: Roslyn csc errors in log and two blank console errors.

This is probably a stupid question, but I have to ask: you explicitly wrote that you use "using unityengine.ui;". Is this really exactly as it is typed in your code (i.e., lowercase)? The correct, case-sensitive line should be
using UnityEngine.UI;

For reference: Appears to be a bug experienced by several people, but it is marked as “NOt Reproducible” by Unity :-/

I solved it by creating a new Unity project. I export the assets from the old project (creating prefabs of terrain and game objects I had created) and imported them in the new project.

Try creating a new Unity project, make a C# script and try to use UnityEngine.UI in the new project. If you don’t get the error message, you should be able to solve the problem the same way I did.

Related to this… is the package version of UI now being phased out?

5522797--567331--Screen Shot 2020-02-26 at 6.57.37 pm.png

If you use vs code this is probably what you want to do. Solved my and others issue.

1 Like

Ok, ok, ok…I’m about 2 hours banging my head against the keyboard and I got lucky. I’m surprised no one suggested this option yet…but my problem may have been slightly different.

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!

Sweet!

2 Likes

There are several .asmdef files.
Which one did you edit?

THIS IS GOLD. took all asmdef from my game and got rid of all errors. Man, I wanna kiss you

Hi, I can’t find any (project-name).asmdef file in my project. I found only .csproj files
Any clue?

Thanks in advance