0
\$\begingroup\$

I work with Unity and Visual Studio 2019 and I have 4 scripts in my project.

I was getting almost every single keyword underlined with the red curvy lines (which shows that it is an error) in all scripts but the game works fine when I start it.

I tried unloading and reloading the solution and also rebuilding and building the solution by following the answers of this question. That solves my problem to some extent. Earlier I had 146 errors and now I have only 42 errors and I noticed that the keywords which are underlined red now (at the time of 42 errors) are a part of the UnityEngine namespace.

I tried restarting Visual Studio and also my computer but that doesn't help.

Even though I am getting those red curvy lines, my game runs well doing all the tasks.

If you didn't understand what am I trying to explain, visit this question. The problem stated in this question is kind of the same as my problem, only the difference is that the answers do not seem to work with the UnityEngine namespace.

Earlier, when I was working on the same project I didn't get those errors without any reason. I am now getting these errors. And I have already installed everything which I needed.

\$\endgroup\$
2
1
\$\begingroup\$

You probably didn't install the additional Unity tools for Visual Studio. Here's what you need to do to setup Visual Studio to work with Unity: https://docs.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/getting-started-with-visual-studio-tools-for-unity?pivots=windows

\$\endgroup\$
1
  • \$\begingroup\$ An edit has been made to the question. You may check it. \$\endgroup\$ – Naitik Srivastava May 18 at 16:41
0
\$\begingroup\$

I don't know how and why but I magically/weirdly solved the errors.

This is what I did -

  1. Made new scripts
  2. Copied the code of old scripts to the new ones
  3. Did everything which was needed for the scripts(like assigning gameobjects to variables etc.)
  4. Deleted the old scripts

Out of my 4 scripts, I deleted only 2 scripts and the problem was solved

I would still like to get answers to this question because I want to know why did this happen and how actually did it get solved by deleting the old scripts.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.