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.

Visual Studio 2022 and Unity

Discussion in 'Editor & General Support' started by amiga4K, Nov 14, 2021.

  1. amiga4K

    amiga4K

    Joined:
    Jan 30, 2018
    Posts:
    68
    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.
     
    arca_98 likes this.
  2. dorusoftware

    dorusoftware

    Joined:
    Jul 5, 2012
    Posts:
    745
    is this version supported in unity? I see only packages for visual code or visual studio 2019
     
  3. amiga4K

    amiga4K

    Joined:
    Jan 30, 2018
    Posts:
    68
    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???
     
  4. GuidewireGames

    GuidewireGames

    Joined:
    Apr 20, 2017
    Posts:
    16
    I think you need to "Regenerate project files". That at least worked for me
    upload_2021-11-16_16-1-6.png
     
  5. amiga4K

    amiga4K

    Joined:
    Jan 30, 2018
    Posts:
    68
    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.
     
    DarthGaydar likes this.
  6. jp-unit

    jp-unit

    Joined:
    Aug 15, 2020
    Posts:
    10
    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.
     
    Cheringer likes this.
  7. jp-unit

    jp-unit

    Joined:
    Aug 15, 2020
    Posts:
    10
  8. jp-unit

    jp-unit

    Joined:
    Aug 15, 2020
    Posts:
    10
    This solved it for me:

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

    upload_2021-11-18_15-18-5.png
     
  9. jp-unit

    jp-unit

    Joined:
    Aug 15, 2020
    Posts:
    10
    Scripts open perfectly from Unity, and all Unity libraries are functioning in the VS2022 IDE correctly.
     
    Flamehawk, Stellarrush and DrMeatball like this.
  10. cjzachary

    cjzachary

    Joined:
    Nov 23, 2021
    Posts:
    1
    I am having the same issue but on windows, any one have a solution for windows?
     
    Clousck likes this.
  11. NeverZeroStudios

    NeverZeroStudios

    Joined:
    Nov 6, 2017
    Posts:
    1
    Thank you, Uninstalling VS2019 and Targeting VS2022 and adding Player Projects Did the Trick for me. VS2022 Works with unity now.
     
    TheOtherBCD likes this.
  12. Razvan_Savin

    Razvan_Savin

    Joined:
    Dec 7, 2021
    Posts:
    2
    I regenerate all .csproj files, now i can work well in Visual Studio 2022. Thank you!
     
    evbe and DevDunk like this.
  13. minispuks

    minispuks

    Joined:
    Dec 23, 2021
    Posts:
    1
  14. paulioms

    paulioms

    Joined:
    Jul 29, 2021
    Posts:
    13
    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 <shrug>
     
    ecreators, rockyouxw and mareksabov like this.
  15. ecreators

    ecreators

    Joined:
    Oct 23, 2016
    Posts:
    7
    Also have no checkbox for project files to tick.
     
  16. huseyinseber

    huseyinseber

    Joined:
    Jul 26, 2016
    Posts:
    1
    worked for me.
    when you click the Player project tick.
     
  17. DiesInLives

    DiesInLives

    Joined:
    Jul 23, 2021
    Posts:
    2
    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.
     
  18. JamesJukie

    JamesJukie

    Joined:
    Jan 6, 2020
    Posts:
    1
    I just changes the editor in the preference, regenerated the project files and it worked fine.
     
  19. Cyzet

    Cyzet

    Joined:
    Mar 30, 2021
    Posts:
    1
    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
     
  20. jazzy-rey

    jazzy-rey

    Joined:
    May 27, 2017
    Posts:
    2
    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.
     
    Alvarden likes this.
  21. VeNHyper

    VeNHyper

    Joined:
    Jan 10, 2022
    Posts:
    1
    worked for me.
    when you click the Player project tick.
     
  22. U20220418

    U20220418

    Joined:
    May 3, 2022
    Posts:
    1
    What should I do if I don't find the visual studio editor package in my package manager
     
  23. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    270
  24. grippie

    grippie

    Joined:
    Mar 16, 2018
    Posts:
    10
    Thsi worked for me!!! Thanks so much.
     
  25. izzy-game-dev

    izzy-game-dev

    Joined:
    Nov 15, 2020
    Posts:
    2
    Awesome, this worked for me!
     
  26. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    466
    Might help someone. I just installed the Visual Studio 2022 and i had issues getting the Unity Explorer Code View to appear. Also the solutions explorer was not showing any code saying it was closed.
    I added the Unity work bench tools from the Visual Studio 2022 Modify menu and regenerated projects but still no good.
    In the end i noticed a little exclamation mark with an install link in the solution explorer panel saying that i was likely missing some important install. I installed it and everything appeared. So watch out for that!!!

    Feel free to remove Visual Studio 2019 and no need to install it on installing from the unity hub.
     
  27. Halo_Shrimp

    Halo_Shrimp

    Joined:
    Aug 27, 2021
    Posts:
    3
    When I using vs2022, coded a script and go back to the unity editor, it told me Missing UnityEngine.Bridge
     
  28. helgrind21

    helgrind21

    Joined:
    Sep 13, 2018
    Posts:
    17
    In my case, I can open the project files on VS2022 through unity but VS2022 does not display the play button to enable debugging. I'm using a mac. Would anyone know how to solve it?
     
unityunity