Search Unity

Visual Studio 2022 Preview: did anybody made it work with Unity?

Discussion in 'Editor & General Support' started by esteban16108, Jun 22, 2021.

  1. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    Hi,

    I wanted to test the new VS 2022, but I couldn't make it work with Unity. When editing Unity preferences I can't find it in the list of external editors.

    I added the Unity extension to VS 2022 tho.

    Did anyone had any luck?
    Thanks!
     
    Madsen87 likes this.
  2. Vectorbox

    Vectorbox

    Joined:
    Jan 27, 2014
    Posts:
    232
    In the Unity external editor list, browse to...

    C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\devenv
     
  3. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    Thank you
     
    Vectorbox likes this.
  4. GennadiyM

    GennadiyM

    Joined:
    Oct 22, 2016
    Posts:
    1
    Is there solution to attach to unity? In VS2019 button 'run' changed to 'Attach to unity', when script was opened from unity. In 2022 it's not. Also there's message at the top saying, that this project wsa not generated for the VS Tools for Unity:
    upload_2021-11-17_14-35-16.png
     
  5. krupps

    krupps

    Joined:
    Oct 17, 2017
    Posts:
    159
    Ignore that message. I get it all the time.

    There are 3 ways to attach. Attach & run, attatch, Attach PCName/Unity, and also go to attach window and change to net 4.x and double click the unity app. Sometimes I had to reboot. When I looked at the window tasks, I would see like 10 unity instances.

    In one project I had to constantly switch around. With small apps debug works fine. I eventually had to just exports parts of my game to sample apps or use tons of logs. When I reported bugs with Unity, I basically was told unless your a Pro subscription we won't even look at it.

    One thing that has helped me tremendously is switching the .NET type from .NET Standard to .NET 4.7.1 in the player settings. No issues debugging since then.
     
    zcarelse_sozolabs likes this.
  6. deegeeooh

    deegeeooh

    Joined:
    Jun 12, 2021
    Posts:
    1
    Like @GennadiyM mentioned, you don't get those options when attaching 2022 instead of 2019..

    Anyone has found a fix attaching Unity 2022 yet?
     
  7. zcarelse_sozolabs

    zcarelse_sozolabs

    Joined:
    Oct 5, 2021
    Posts:
    1
    I kept on having to Attach Unity Debugger with VS 2022 and this fixed that completely. Thanks.
     
  8. krupps

    krupps

    Joined:
    Oct 17, 2017
    Posts:
    159
    I'm also using VS Enterprise, so there may not be all of the options in your version. Although I'm afraid of going VS 2022, because the first year of any VS product is painful.