We are trying to export our project for android and in the middle of compiling there is an error that says :
Assets/Scripts/GameController.cs(2,19): error CS0234: The type or namespace name
UI' does not exist in the namespace UnityEngine’. Are you missing an assembly reference?
and when we comment this line, we can not use ‘Text’ type for new ui system.
what should we do now and what is the answer?
I tried restart unity, but same.
unity version is 5.3.4
I tried Asset->Reimport All. ( import other dlls, etc. )
Restart Unity, if this does not solve the issue Re-import everything.
i have same problem , whats the version of your unity ?
i use 5 and i get this error , then change it to 4.6 and its work !!!
you can see my question in my profile
if you use 4.6 , go to mono develop and open “edit references” from “project” menu . if you don’t see UnityEngine.UI in right hand of window , choose it from the list in left and add it to your references
restart the unity engine solve the problem
If someone still has this problem and is using VS Code try to install the VSCode asset in the assets store
EDIT: Another more simpler solution i found was to downgrade Visual Studio Code Editor in the package manager to the version 1.1.3 + restart everything
(Window > Package Manager > Visual Studio Code Editor)
The same thing happened to me following a version upgrade.
Go to build settings and if you’re on ‘Web Player’, switch to PC.
In the Assets for the Script you are having problems with, right mouse on the script and select: “Sync MonoDevelop Project”
go to: Edit > Preference > External Tools…
in External script editor > click on browse > go to unity file > Editor File and click on mono develop.
This happened to me when I moved my project to a different PC.
I figure that, somehow, my Packages folder got corrupted in the process of moving my project from my working PC to my portable HDD and to another PC.
To fix the issue I just right-clicked on the Packages folder in the Project window of my open project and selected “Reimport All”. All the errors disappeared.
I have the same problem with UnityEngine.AI I literally copy the code from the website and it still doesn’t work, I have Reimport All, Close and Open several times, change the build setting, there is nothing I can do !!!,I tried everything, my UnityEngine.UI works but not my UnityEngine.AI
I reimport several times, close the project, open it, change the build settings… Nothing to do I am losing it
Deleting the Library folder might have done it for me.
If this happens after you import a new asset from asset store it simply means that the new asset has a script of same name that an old asset is having.
Sometimes in hurry you may not check this while importing and the old script might get deleted.
So keep an eye while importing a new asset and if you find scripts with same name you better rename it before importing.
For me what worked is Help → Reset Packages to Default
This is due to one issue. UnityUI.dll is present in the location of Library/ScriptAssemblies(library of your project).
If you will open your Assembly-CSharp.csproj ,search
if it is not present there add
For Mac Users
<HintPath>/Users/[Path to your current project]/Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
For Window Users
UI was only introduced in Unity 4.6. Download the latest version from http://unity3d.com/unity/download