Visual Studio 2022 and Unity

Hello,
I just installed Visual Studio 2022 with Unity 2021.1 and the package Visual Studio Editor 2.0.12 but it seems as nothing is working anymore.

The same problem with Unity 2021.2.

No link with Unity…

Has anyone else had the same problem as me?

Thanks.

2 Likes

is this version supported in unity? I see only packages for visual code or visual studio 2019

https://docs.unity3d.com/Packages/com.unity.ide.visualstudio@2.0/changelog/CHANGELOG.html

Code Editor Package for Visual Studio
[2.0.12] - 2021-10-20
Integration:

  • Do not block asset opening when only a VS instance without a loaded solution is found.
  • Only check package version once per Unity session.
  • Improved support for Visual Studio For Mac 2022.

Maybe not? Only for Visual Studio For Mac 2022???

I think you need to “Regenerate project files”. That at least worked for me

18 Likes

Unfortunately it didn’t work for me. However your IDE is Visual Studio 2019. Mine is Visual Studio 2022. In fact the post concerns VS 2022.

2 Likes

Any solution to this, I also have the same issue.

In Unity->Preferences->External Tools->External Script Editor I have broswed to:
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe

I regenerated the project files.

Unity is not opening scripts etc
If I manually open and edit the C# scripts then VS 2022 doesn’t recognise the unity libraries etc

I’m not sure what to try next.

4 Likes

Link to MS Documentation:

1 Like

This solved it for me:

Be sure the Player Projects is Ticked.
Then press Regenerate project files.

7667950--957424--upload_2021-11-18_15-18-5.png

51 Likes

Scripts open perfectly from Unity, and all Unity libraries are functioning in the VS2022 IDE correctly.

3 Likes

I am having the same issue but on windows, any one have a solution for windows?

1 Like

Thank you, Uninstalling VS2019 and Targeting VS2022 and adding Player Projects Did the Trick for me. VS2022 Works with unity now.

2 Likes

I regenerate all .csproj files, now i can work well in Visual Studio 2022. Thank you!

2 Likes

Thank you. I was missing the Unity Workload for VS2022 (Tools > Get tools and Features > Game development with Unity)

Neither fixed it for me. Or at least I keep getting the ‘This Unity Project was not generated…’ message in VS2022. Seem to work alright though

3 Likes

Also have no checkbox for project files to tick.

worked for me.
when you click the Player project tick.

1 Like

If you are refreshing after ticking on “Player project” only, it won’t work…You have to close Visual Studio 2022 (if open) and then open it again by clicking on the script you want to edit…If you have not opened VS2022 then you can ignore this.

I just changes the editor in the preference, regenerated the project files and it worked fine.

I just change from 2019 to 2022, I already tick all boxes in the external tool still doesn’t work. But inside visual code on “Solution Explorer” panel or tab. There are files like “Assembly-Csharp” and more still (unloaded).

I try to select all those unloaded files and right click “reload project” and it works hope it help

1 Like

for anyone that is still going through this the only thing you have to do is update Visual Studio Editor Package on Package Manager to the 2.0.15 version or higher.

5 Likes