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

For No Apparent Reason Over 100 Errors Cs0246: The Type Or Namespace Name (namespace) Could Not...

Discussion in 'Scripting' started by adreamvoyager_unity, Apr 10, 2019.

  1. adreamvoyager_unity

    adreamvoyager_unity

    Joined:
    Oct 16, 2018
    Posts:
    14
    Hey everyone,

    I am currently involved in a fairly large project. For some reason an issue has surfaced that I seem unable to resolve. I have several different assets installed into the project. Many of the assets have Editor folders for custom Inspector scripts.

    Everything worked fine without any issue, however the other day I suddenly was hit with over 100 errors on all the scripts in the Editor folders:

    I checked the files themselves and there wasn't any errors marked in the code, even though unity was registering an error. All of the scripts were functioning properly up to this point, and I had been developing the application for at least six months.

    I figured there must have been some sort of file corruption in the unity system. I rebuilt the project, and reimported everything. Neither option worked. Finally I created a blank Unity project and I dragged all of the files into the new project. Everything started working again.

    This was several days ago. I have continued working inside the new Unity project since this issue occurred. For some reason, today after deleting some legacy post processing files I found in one of the directories the error resurfaced.

    It appears this may be an error with Unity itself. Has anyone encountered this sort of issue before. If so does anyone have any suggestions on why it is happening and what I can do about it?


    Part of the Error Log:
     
    Last edited: Apr 10, 2019
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,151
    So to be clear, you deleted some files and only after deleting those files, you got these editor file errors?

    Now, the next question. Do these "errors" create any issues? Editor stuff sometimes throws what appears to be errors, but it doesn't actually break anything. Clearing the console clears them out and everything still functions just fine. I assume it just has something to do with how the editor scripts change the editor functions sometimes, but I've never worried about it as long as it didn't really do anything.
     
  3. adreamvoyager_unity

    adreamvoyager_unity

    Joined:
    Oct 16, 2018
    Posts:
    14
    Yes, Unity will not run, and the errors will not go away when I clear the console.

    The folder I deleted was an old Post Processing Stack in the assets folder. I have a new version downloaded as a package. I have deleted the post processing stack folder on several projects whenever I upgraded them to a new version of Unity. This has never caused an issue in the past. The errors I have do not appear to be related. It seemed I simply triggered Unity to try to recompile some of the scripts, and this triggered the error. That is my best theory anyway. The first time this error occurred, I didn't do anything. It happened randomly. After copying and pasting all the project files into an empty unity project, everything worked fine again.

    Now the exact same issue is happening again..... :\

    I could start over again and copy and paste all my assets into a blank Unity project, but this is very time consuming, as my project is over 10gb, and if this issue happened it seems it will likely happen a third time.
     
    Last edited: Apr 10, 2019
  4. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    Did you try simple things like deleting library folder and also delete postprocess by packagemanager instead of deleting the files manually? Just to be sure to not confuse the package config xml
     
    zipo13 and Deleted User like this.
  5. adreamvoyager_unity

    adreamvoyager_unity

    Joined:
    Oct 16, 2018
    Posts:
    14


    Hi and thank you for the reply.

    There may be something wrong with the package config.xml file. It's worth looking into. I am not sure how long you have been using Unity, but the old version of Unity required people to download the post processing stack through the asset store, before the package manager existed. This version of post processing is stored in the assets folder instead of the packages folder. From my experience if I download post processing from the package manager I will end up with two different versions of post processing, one in the assets folder and one in the package manager folder. To resolve this issue I ended up deleting the version that is stored in the assets folder. This version, as far as I know, cannot be removed through the package manager. If I try to remove it through the package manager it will remove the newer version, but it will not touch the older version stored in the assets folder. The only option, as far as I know, to remove the Asset store version from an older unity version is to manually delete it.
     
  6. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    Totally right about the old one, but as I would think of using the newest version, i would redo the project once without the old stack and just install the new one.
     
  7. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,386
    I don't know if this would help at all in your case, but when I get this-or-that namespace cannot be found and I know for certain that it's in my project, I can sometimes fix it by deleting the VS (Visual Studio) project file that's in the Unity project folder. Unity should automatically create a new one. (Remember to back-up your project befor you try anything fiddly, though. ;) )
     
    adreamvoyager_unity likes this.
  8. adreamvoyager_unity

    adreamvoyager_unity

    Joined:
    Oct 16, 2018
    Posts:
    14
    I created a blank unity project and copy and pasted all of the project files over. This worked for a while, however the issue returned. I tried to delete the SLN file and it did not fix anything.....

    :(
     
  9. adreamvoyager_unity

    adreamvoyager_unity

    Joined:
    Oct 16, 2018
    Posts:
    14
  10. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    What version of Unity are you using, and why do you have scripts referencing GvrAudio when that was deprecated and replaced with Resonance Audio? Where did this ColorsVR folder come from, and are you sure that everything it needs is in your project?
     
  11. adreamvoyager_unity

    adreamvoyager_unity

    Joined:
    Oct 16, 2018
    Posts:
    14
    This is a compilation of multiple projects made by multiple people. I am using unity 2018.3. I realize there is probably some deprecated code, however everything works most of the time, and I do not believe the deprecated code is the cause of the issue.

    The way my work flow is happening right now, just to illustrate my dilemma. Everything works fine most of the time. For some reason, randomly, every few weeks or so, the glitch gets triggered. The only way I am able to resolve it is by copy and pasting all of the assets into an empty project, Unity reimports everything which takes at least an hour. This fixes everything, but then a week or two later, without any sign of the glitch, all of a sudden all of the errors appear again, and I am unable to run the project. Then I have to rinse and repeat...........
     
  12. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    Are you able to test this on another machine for some days/weeks? Maybe your system is corrupt, and are you using the latest version of VS? Maybe try another environment for testing too.
     
  13. ThomasGaist

    ThomasGaist

    Joined:
    May 12, 2019
    Posts:
    11
    bump, I have the same issue..
    Code was fine except for one error involving some A* pathfinding file, I updated VS hoping it might resolve itself. Instead of it fixing the issue it resulted in over 27.000 errors, most of them relating to the CS0246 problem as far as I can see.
     
    Last edited: Jun 16, 2019
  14. ThomasGaist

    ThomasGaist

    Joined:
    May 12, 2019
    Posts:
    11
    I found the solution to my problem it might be applicable to your problem!
    After mailing my project to one of the VS microsoft devs, it turned out that a recent update didn't recognize ":" in the name of the project, and my project had a ":" in it's title. Changing the title fixed the issue immediately. So a very simple solution to a serious issue.
     
  15. adreamvoyager_unity

    adreamvoyager_unity

    Joined:
    Oct 16, 2018
    Posts:
    14
    Unfortunantly, this didn't seem to help......
     
  16. berizdautovic933

    berizdautovic933

    Joined:
    Aug 5, 2019
    Posts:
    2
    Guys I also have the similar issue. I was working yesterday on a project, everythign was smooth, I shuted down my laptop and all the usual stuff. Today I tried to turn on my laptop, but there were some issues, and I couldn't turn it on, so Setup repair did something and anyways I turnod on my laptop. I opened Unity, created a new project(empty), and there were about 300 errors with cs0246. I was reinstalling unity and all that stuff, btw I am using 2019.2.01f version. I reinstalled it and it didn't help.I was trying literally everything and I couldn't fix it. It also says that a file with .dll extension is missing and something like that. So my thoughts are that Startup repair(system restore) deleted some files, or it may be because of VS( when I turned on my pc visual studio popped up and was installing something idk). I have no idea what to do.
     
  17. Deleted User

    Deleted User

    Guest

    Awesome advice, man. This fixed the issue for me, and trust me, nothing else did. I hope the universe rewards you today for your efforts. You deserve it.
     
  18. Theo-dubioous

    Theo-dubioous

    Joined:
    Jun 7, 2021
    Posts:
    1
    This solution worked for me, if it can help someone.

    For each missing reference :
    (1) Search the script in the OS file explorer, and delete the .meta file associated with it.
    (2) Open the script in Visual Studio and hit save.
    (3) A new .meta file has been generated and the script is now referenced.

    I am not completely sure what generated the bug in the first place though, but i I think it involved version control with git.
     
    Last edited: Jun 21, 2022