Search Issue Tracker
Not Reproducible
Votes
1
Found in [Package]
Issue ID
1152478
Regression
Yes
Upgrading projects to 2019.2 Beta can introduce reference errors to UnityEngine.UI
UPDATE: As of recent backports, this issue can now be resolved with a reimport or restart of the editor. Is there a way we can automate this process for our users, so they are not caught trouble shooting and losing time to reimporting after the upgrade process is already done?
In 19.2 (as recent as 0b8), upgrading certain projects will introduce reference errors related to UnityEngine.UI. This has been encountered in *most* projects during Upgrade testing, however this is most easily seen in Scenario-pang (attached):
- Assets\Scripts\Ellen\CharacterController.cs(5,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
- Assets\Scripts\Ellen\CharacterController.cs(10,12): error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)
- Assets\Scripts\UI\LifeController.cs(4,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
- Assets\Scripts\UI\LifeController.cs(8,13): error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
Additional information:
- As of recent backports, this issue can now be resolved with a reimport or restart of the editor.
- These errors do not occur if the same files and their dependencies are extracted into a new 2019.2 project.
- As of 2019.2.0b1, UnityEngine.UI (UGUI) has been extracted to a package
Steps to reproduce:
1- Download the attached projected
2- Open the project in Unity, electing to upgrade when prompted
3- Observe errors referencing UnityEngine.UI
Reproduced in 2019.2 as late as 0b8.
-
kalpitteotia1999
Sep 28, 2020 07:18
I just copy UnityEngine.UI,dll from another project and copy to my project in assets and its works fine for me.
-
Bmco
May 21, 2020 12:10
Using 2019.3.0a3
FYI...I had a similar problem where I split UI code into a different assembly and lost all my UnityEngine.UI references.
All I had to do was add the "Unity.ugui" reference to my new .asmdef file and then "using UnityEngine.UI" in my scripts worked again.
-
blobface
May 06, 2020 23:44
I've had this issue for months, what solves it for me is downgrading the Visual Studio Code Editor package to 1.1.2, both 1.1.4 and 1.2.0 has this issue for me.
-
ravneet77
May 05, 2020 15:14
Please ignore my last comment, for some reason when I did that it make it look like UnityEngine.UI and removed the errors but it came back, in my case UnityEngine.UI was totally missing from the project, I had to copy it from another project:
1 look for a file called "UnityEngine.UI.dll" in another project.
2 copy that file in your current project
3 in visual studio go to project > add reference > browse
4 select the UnityEngine.UI.dll file, it will reference it and everything will work as usualThis worked for me.
-
saru15
Apr 29, 2020 10:47
Same!! My project was working fine until I import the google Admob plugin and then all the UI references are gone.
-
Ricky-Brno
Mar 28, 2020 03:12
This is 100% related to project upgrades. Happened to me already twice with same project, recently after upgrade to 2019.3.6f1.
Tried:
- Updating VSCode plugin to latest 1.2.0 - didn't help
- Tried to delete .csproj and .sln files and let Unity generate new - didn't help
- Opened project in Visual Studio Community - same issue
- Changed external editor in Unity to Visual Studio Community (rather then VSCode) - THIS HELPED!!!Not sure why, but changing external editor in Unity to VS Community is obviously doing something more then just changing reference to external application. I was then able to switch to VSCode again and works like a charm again
Maybe it will help someone hitting this page
-
RowdyCoder
Mar 20, 2020 19:09
I just ran into this issue as well. The culprit is definitely related to upgrading an existing project. My upgrade path was 2019.3.6f1 to 2019.3.5f1.
In order to resolve the problem I simply exported out all of my assets. Started a new project and re-imported the assets. Not ideal but it beat trying to delete manifest files, and or editing definition files with the proper reference of which I couldn't find.
YMMV obviously.
-
jack101yello
Mar 08, 2020 22:55
Hi,
I've been having this same issue on 2019.2.21f1. I've tried everything that I could find online to no avail. Does anyone have any other fixes? Thanks! -
muraDev
Feb 16, 2020 14:50
Thank you so much DIEGO-VIEIRA. Your solution fixed it
-
diego-vieira
Feb 09, 2020 16:02
For those who are facing this problem yet:
#1. Remove all .sln and .csproj files
#2. Make sure the "Generate all .csproj files." checkbox is checked on Preferences
#3. Reopen C# ProjectThis worked for me, hope help you as well
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Overlay Image gets darker on each Camera when multiple Cameras are used
- Assertion failed on expression: 'scriptedImporterClass == SCRIPTING_NULL error when opening the standalone profiler window
- Disabled assets in Import Unity Package window aren't tracked but count as being selected by user
- [Windows] Crash on GetManagerFromContext when video is playing and creating High Definition 3D Projects after FMOD failed to switch back to normal output Error appeared
- GC Alloc produced when adding items to MultiColumnListView with Auto Assign Binding
Resolution Note:
The issue is resolved in later 2019.2 non-beta builds and not present in 2019.3 and later.
These references also need to be added to the*.Asmdef files in the project. This will resolve any issues, save for *.Asmdefs in packages which have not been updated accordingly.