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

Error CS0234 after updating the editor and hub.

Discussion in 'Editor & General Support' started by Gamadrila, Feb 3, 2022.

  1. Gamadrila

    Gamadrila

    Joined:
    Sep 5, 2021
    Posts:
    142
    After the update, all versions of the editor disappeared. I didn't find them anyway. Also, Visual Studio got error CS0234. He doesn't like the Collections namespace and Link. There are no errors in the editor itself and the project works stably.

    During the update and at the first start, some messages popped up, but I don’t know English and it’s impossible to select the text for the online translator, so I just clicked on. The bug report menu appeared, but I turned it off and restarted the computer. It used to solve all problems. I have windows 7. How to fix an error in Visual Studio? I read Microsoft help, it was very interesting. Is it possible to make the background white in the hub?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    Remember: NOBODY here memorizes error codes. That's not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

    The complete error message contains everything you need to know to fix the error yourself.

    The important parts of the error message are:

    - the description of the error itself (google this; you are NEVER the first one!)
    - the file it occurred in (critical!)
    - the line number and character position (the two numbers in parentheses)
    - also possibly useful is the stack trace (all the lines of text in the lower console window)

    Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

    All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don't have to stop your progress and fiddle around with the forum.

    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
     
  3. Gamadrila

    Gamadrila

    Joined:
    Sep 5, 2021
    Posts:
    142
    Error CS0234 The type or namespace name 'Collections' does not exist in the namespace 'System' (possibly missing an assembly reference).

    This is the first and second line.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    Error CS0234 The type or namespace name 'Linq' does not exist in the namespace 'System' (perhaps missing an assembly reference).
    Third line.
    Code (CSharp):
    1. using System.Linq;
    ?
    Works half way.
    Code (CSharp):
    1. using UnityEngine;
    Working.
    Code (CSharp):
    1. using System.
    No choice.

    Visual Studio latest version.
    I always do this.

    Where is this file located?

    I did it right away. In Microsoft's right, it is written that this is related to the NET Framework. I didn’t do anything with him and before doing something I decided to ask on the forum. The setup is not easy. Before updating the hub and the editor, everything worked. Is there a better forum for Unity?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    Given the above, and given that you note this:

    I'm thinking it's not a Unity problem but a typical Visual Studios flakiness issue. Nuke all of VS's files (sln, csproj, userprefs, .vs, .vsconfig), all the crap that Unity regenerates and Visual Studios breaks during normal operation, the stuff you never commit to source control.
     
    Gamadrila likes this.
  5. Gamadrila

    Gamadrila

    Joined:
    Sep 5, 2021
    Posts:
    142
    Yes, it helped. Everything has become much faster to load. A forum is still better than a search. In a cursory search, I did not see such a solution.
    Thank you.
     
  6. fabiareor

    fabiareor

    Joined:
    Jul 30, 2019
    Posts:
    5
    Hello, I am having the same problem of getting this type of error
    "error CS0246: The type or namespace name 'EditorScript' could not be found (are you missing a using directive or an assembly reference?)"
    for almost all of my scripts when I try to build my project.

    I already tried the solutions shown above of deleting all the VS files I have done it several times but I still have the problem. Can I get a more detailed explanation on how to solve this issue please.
     
  7. Gamadrila

    Gamadrila

    Joined:
    Sep 5, 2021
    Posts:
    142
    I don't have that kind of space. This is something not standard. Are you sure that you have such a space? Maybe you need to create it first. Post a screenshot, maybe someone can help.