7
\$\begingroup\$

As I have sometimes problems with intellisense in visual studio using unity, I searched for some answers. It was almost every time pretty much the same: Reloading the project. But in my solution explorer, there is not even a project showing that I could reload. Are you able to manually create the project or are there some reasons for that behavior?

ps: I just updated unity from version 2017.3.0f3 to 2018.1.0f2, may that be the problem? (I'm using visual studio 2017 (I'm updating at the moment on version 15.7.1) community)

edit: What I've tried so far:

  1. Simply re-launching Visual Studio by double-clicking on the script file inside unity (-> DMGregory)
  2. reloading the project
  3. reimport all in the asset-explorer inside unity (S. Tarik Cetin)
  4. deleting the .sln file to force Unity to regenerate them from scratch (-> Ed Marty) + opening the solution from inside Visual Studio

Doing the last point created - as intended - a new solution, but there is still no project created, as you can see in the following picture (Projektmappe = solution). That's how the solution looks like.That's how the solution looks like. While opening the script from Unity, it shows the message in the following picture. Translation:Message when opening "The following files were stated in the command line: [source path (name censored)] These files were not found and are not loaded."

When trying to open a script from a different (new) Project, it showed the same message, which leads to a new problem: Even in new unity projects, the solution cannot be opened, and the scripts are all assigned to a certain solution ("solution1"), which is the one that was generated. (Even scripts from different projects end up in the same solution!)

So at the moment, I have no idea what else to do. Is there something simple I'm just missing? Or should I reinstall one of the 2 programs? Or might the update of unity be the problem? (exact versions mentioned above)

If there's any extra information needed, please just mention it in the comments. (I'm not so sure what might be helpful and what isn't)

\$\endgroup\$
4
  • \$\begingroup\$ Usually I close Visual Studio and re-launch it by double-clicking on one of my script files inside Unity. \$\endgroup\$
    – DMGregory
    Commented May 13, 2018 at 13:55
  • \$\begingroup\$ @DMGregory I already tried it a couple of times, didn't work. \$\endgroup\$
    – some_user
    Commented May 13, 2018 at 13:56
  • \$\begingroup\$ Try Reimport All option in the context menu of asset explorer. \$\endgroup\$ Commented May 13, 2018 at 15:02
  • \$\begingroup\$ Listing the full version numbers for both Unity & visual Studio might help. \$\endgroup\$
    – Pikalek
    Commented May 18, 2018 at 16:03

6 Answers 6

5
+50
\$\begingroup\$

It seems there is a problem with asmdef files in Unity 2018 with Visual Studio 2017, you'll need an update.

https://developercommunity.visualstudio.com/content/problem/88183/error-when-unity-launches-visual-studio-2017-to-ed.html

https://developercommunity.visualstudio.com/content/problem/130597/unity-intellisense-not-working-after-creating-new-1.html

https://forum.unity.com/threads/issues-with-visual-studio-unity.514304/

You can try the following:

  • Update your Visual Studio 2017 to the latest version. (v15.7.1)

This will most likely solve your problem. If not:

  • Delete asmdef files from packages folder of Unity. But this may cause your project to not compile if you have a dependency on those packages. The folder should be in C:\Users\ {UserName}\AppData\Local\Unity\cache\packages\packages.unity.com
\$\endgroup\$
0
6
\$\begingroup\$

Happened to me too. Solved it by setting Visual Studio as the default 3rd party tool as scripts editor in Unity's preferences.

\$\endgroup\$
2
  • \$\begingroup\$ This was it in my case. The External Script Editor was set to 'Open by File Extension' and it worked when I change it to Visual Studio \$\endgroup\$
    – Paul O.
    Commented Jan 17, 2021 at 19:21
  • \$\begingroup\$ This was also the case for me. Event series: 1. Already had VS 2019 and 2022 installed 2. Installed unity (without the VS 2019 option because it's already installed) 3. Opening a cs file from Unity would then just open the file without a csproj and without the Unity packages in the csproj 4. Changed Unity setting (Edit -> Prferences -> External Tools -> External Script Editor -> Change "Open by file extension" to Visual Studio) 5. Opening a cs file from Unity would then create a csproj with Unity packages as dependencies \$\endgroup\$ Commented Sep 11, 2021 at 5:00
2
\$\begingroup\$

It happened to me too. I solved it by updating visual studio.Try installing the latest version.

\$\endgroup\$
0
1
\$\begingroup\$

I wasn't able to find anything that specifically targeted the problem you described. It's possible that this might be an issue that occurs only from updating one of the products from one version to another. As a general troubleshooting solution, try the following:

  1. Back up your work!
  2. Uninstall Unity.
  3. Uninstall Visual Studio
  4. Reinstall Visual Studio using the most recent stable version available.
  5. Reinstall Unity using the most recent stable version available.
\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the answer, but updating visual studio was sufficient. =) \$\endgroup\$
    – some_user
    Commented May 19, 2018 at 8:57
0
\$\begingroup\$

Have you tried simply deleting the .sln and .csproj files from the root directory of your project? That’s will force Unity to regenerate them from scratch if they got mangled somehow Unity doesn’t recognize as a problem.

\$\endgroup\$
3
  • \$\begingroup\$ That didn't work, too. There was just a new solution created. \$\endgroup\$
    – some_user
    Commented May 13, 2018 at 14:58
  • \$\begingroup\$ That’s what’s supposed to happen. Have you tried just opening the solution from Visual Studio directly? If the same problem occurs try a blank Unity project, and/or a blank Visual Studio project. Depending on the results you may want to try uninstalling/reinstalling one or the other. \$\endgroup\$
    – Ed Marty
    Commented May 13, 2018 at 15:04
  • \$\begingroup\$ I made another blank unity project, and its scripts are now opened under the same solution that was generated. Is this intended? \$\endgroup\$
    – some_user
    Commented May 13, 2018 at 15:39
0
\$\begingroup\$

You might inadvertently fix this problem by reinstalling everything but this potential solution is worth 30 seconds to try. It worked for me. Within Unity: Edit -> Preferences -> External Tools -> External Script Editor -> Change "Open by file extension" to Visual Studio).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .