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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Visual Studio 2019 doesn't have "Attach to Unity" but only in a new project.

Discussion in 'Editor & General Support' started by etansivad, Jul 21, 2019.

  1. etansivad

    etansivad

    Joined:
    Nov 3, 2018
    Posts:
    3
    I have a new Unity project that for whatever reason I can only manually connect the debugger in Visual Studio. Up at the top where all of my older projects say "Attach to Unity" next to the green "Run arrow" this new project has just "Start" like it's a regular C# solution. If I attempt to debug and click start it I get the error "A project with an output Type of Class Library cannot be started directly."

    I can manually attached to unity by going Debug -> Attach Unity Debugger -> Selecting Unity. So I know that Visual Studio has all the pieces it needs. But that's a tedious way to get the debugger working. All of the forum posts I've found are assuming that Visual Studio is missing a component, but it's my project that's configured wrong and I'm not sure what's wrong.

    My old project shows an icon of the Unity Debugger in front of a Win form. (I tried to post an image, but the spam catcher nuked it)


    My new project shows "C#" in a box with a green border.

    The Icons are different, so my solution is set wrong, but I'm not sure how to fix it. Every setting I compare on the two solutions are identical.

    Any ideas?

    Thank you
     
  2. etansivad

    etansivad

    Joined:
    Nov 3, 2018
    Posts:
    3
    See the images for the two Icons I'm getting.
     

    Attached Files:

  3. AkhaSkull

    AkhaSkull

    Joined:
    Mar 6, 2014
    Posts:
    10
    Delete the sln visual studio project file in your unity project Directory.
    Restart Unity, then go to Edit > Preferences > External Tools and re-select VS as your external editor.
    Unity re-generate the sln file in your project directory.
    Then go to Assets > Open C# Project.
     
  4. andyblem

    andyblem

    Joined:
    Nov 11, 2014
    Posts:
    26
    worked for me
     
  5. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    379
    Awesome, this worked me also. Thank you!