Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug [Solved] The type or namespace 'UI' does not exist in namespace 'UnityEngine' and more

Discussion in 'Scripting' started by ThatBusyBoi, Dec 2, 2022.

  1. ThatBusyBoi

    ThatBusyBoi

    Joined:
    Sep 17, 2022
    Posts:
    2
    [PROBLEM SOLVED]
    Well I found a solution thanks to Yossi2010 on StackOverflow: https://stackoverflow.com/a/69769342
    Apparently, I was supposed to untick everything on the generate csproj files tab and THEN regenerate the project files:
    unity namespace error solution.png

    Not sure why I had to do this, but I'm gonna say that by checking on one type of package, it prevents it from being regenerated. At least I got this problem solved.

    --------------------------------------------------------MAIN PROBLEM-------------------------------------------------------​


    Whenever I include a new directory from the UnityEngine namespace, Visual Studio Code doesn't seem to recognize them, which will count these as errors despite the fact that Unity can read and process these scripts just fine. I've tried downgrading my unity vsc package and regenerating project files but neither of them worked. Is there any other method I can use that can fix this?

    unity namespace error problems tab.png unity namespace error red lines.png
     
    Last edited: Dec 3, 2022
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    UnityEngine.UI is now a package:

    https://forum.unity.com/threads/where-did-the-ui-option-in-the-create-menu-go.1134796/#post-7290742

    Annoying possible issue circa October 2021:

    https://forum.unity.com/threads/unityeditor-ui-csproj-not-found.1177432/

    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874
     
    wangsitan likes this.
  3. ThatBusyBoi

    ThatBusyBoi

    Joined:
    Sep 17, 2022
    Posts:
    2
    None of these work. Also Im trying to work with that last link but I don't know where to input that command since that looks like something for Linux. I'm on Windows. I tried to reinstall the unity vsc component but it didnt work either so I really don't know what else to do.
     
    Vickey_Soni likes this.
  4. parkmag

    parkmag

    Joined:
    Jan 17, 2017
    Posts:
    1
    solved install from package manager "unity ui" o_O
     
    gurbrindersingh likes this.